Lighthouse CI "assertions failed" in CI
The lhci assert step compares audit results against the thresholds in your lighthouserc and exits non-zero when any assertion fails. The output lists each failing audit, the expected threshold, and the value found.
What this error means
The lhci step prints "X assertion(s) failed" with a table of failing audits such as categories:performance or first-contentful-paint and the actual versus expected values.
Checking assertions against 1 URL(s), 3 total run(s)
1 result(s) for categories:performance failure
expected: >=0.9 found: 0.74Common causes
A real regression dropped a score below budget
A change increased bundle size, blocking time, or layout shift, pushing a category or metric under its asserted threshold.
Thresholds are stricter than the app can meet
A preset like lighthouse:recommended may assert values the current app does not reach, failing every run.
How to fix it
Read the failing assertions and address the metric
- Open the lhci output to see which audits failed and by how much.
- Fix the underlying issue (reduce JS, defer resources, add image dimensions) or adjust the threshold if it is unrealistic.
- Re-run lhci to confirm assertions pass.
Tune assertions in lighthouserc
Set explicit, achievable thresholds per audit so the budget reflects the app's real target.
// lighthouserc.json
{ "ci": { "assert": { "assertions": {
"categories:performance": ["error", { "minScore": 0.8 }]
} } } }How to prevent it
- Set assertion thresholds you can realistically hold, then ratchet up.
- Run multiple Lighthouse runs to reduce variance before asserting.
- Track score trends so regressions are caught at the PR that caused them.