Skip to content
Latchkey

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.

lighthouse
Checking assertions against 1 URL(s), 3 total run(s)

1 result(s) for categories:performance failure
   expected: >=0.9  found: 0.74

Common 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

  1. Open the lhci output to see which audits failed and by how much.
  2. Fix the underlying issue (reduce JS, defer resources, add image dimensions) or adjust the threshold if it is unrealistic.
  3. 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
// 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.

Frequently asked questions

What causes ""assertion(s) failed""?
A change increased bundle size, blocking time, or layout shift, pushing a category or metric under its asserted threshold.
How do I fix "assertion(s) failed"?
Read the failing assertions and address the metric

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card