Your page logs errors to the browser console, indicating unresolved problems that may affect functionality or user experience.
Lighthouse scans the browser console for error-level messages during page load. These errors come from JavaScript exceptions, failed network requests, CORS issues, deprecated API usage, or security policy violations. Each error represents something broken or misconfigured.
Console errors signal problems users might experience—broken features, missing content, or degraded performance. Even if the page appears to work, these errors often indicate edge cases where things fail.
JavaScript Runtime Errors:
Uncaught TypeError: Cannot read properties of undefined (reading 'map')
at ProductList.js:42
Failed Network Requests:
GET https://api.example.com/data 404 (Not Found)
CORS Errors:
Access to fetch at 'https://api.example.com' from origin 'https://yoursite.com'
has been blocked by CORS policy
Content Security Policy Violations:
Refused to execute inline script because it violates the following
Content Security Policy directive: "script-src 'self'"
These are bugs in your code. The stack trace points to the source.
Null/Undefined Access:
// Before - crashes if user.profile is undefined
const name = user.profile.name
// After - defensive access
const name = user?.profile?.name ?? 'Anonymous'
Array on Non-Array:
// Before - crashes if data isn't an array
const items = data.map(item => item.id)
// After - ensure array exists
const items = Array.isArray(data) ? data.map(item => item.id) : []
Missing DOM Elements:
// Before - crashes if element doesn't exist
document.getElementById('app').innerHTML = content
// After - check element exists
const app = document.getElementById('app')
if (app)
app.innerHTML = content
404 and 500 errors indicate missing or broken resources.
Missing Assets:
API Failures:
const response = await fetch('/api/data')
if (!response.ok) {
console.warn(`API returned ${response.status}`)
return fallbackData
}
return response.json()
Cross-origin requests fail without proper server configuration.
Server-Side Fix (API server):
// Express.js
app.use((req, res, next) => {
res.header('Access-Control-Allow-Origin', 'https://yoursite.com')
res.header('Access-Control-Allow-Methods', 'GET, POST, OPTIONS')
res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization')
next()
})
add_header Access-Control-Allow-Origin "https://yoursite.com";
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
If You Don't Control the API:
Errors from external scripts (analytics, widgets, ads) still count against your page.
Ad Blocker Errors:
Lighthouse ignores ERR_BLOCKED_BY_CLIENT by default, but other blocking patterns might slip through.
Outdated Third-Party Scripts:
<!-- Check for newer versions -->
<script src="https://cdn.example.com/widget-v2.js"></script>
Missing Fallbacks:
// Handle missing third-party gracefully
if (typeof ThirdPartyWidget !== 'undefined') {
ThirdPartyWidget.init()
}
Deprecated APIs: Update code using deprecated browser features. The console message typically suggests the replacement:
[Deprecation] SharedArrayBuffer requires cross-origin isolation.
CSP Violations: Adjust your Content Security Policy or fix the code violating it:
<!-- Instead of inline scripts -->
<script>doSomething()</script>
<!-- Use external files -->
<script src="/js/init.js"></script>
Console error issues often appear alongside:
Console errors often hide on specific pages—a contact form with a broken validation script, a product page referencing missing images, or an admin section with outdated dependencies. Scan every page to find errors across your entire application.