Skip to content
Latchkey

Psalm "ERROR: ... N errors found" in CI

Psalm analyzed the codebase against its configured errorLevel and found issues it reports as errors, so it exits non-zero. Each issue names a type (PossiblyNullReference, InvalidArgument) with the file and line.

What this error means

The Psalm step ends with issue blocks and "ERROR: ... ------------------ N errors found", failing CI. The errorLevel in psalm.xml controls how strict the check is.

Psalm
ERROR: PossiblyNullReference - src/Report.php:48:16 - Cannot call method format
on possibly null value

------------------------------
3 errors found
------------------------------

Common causes

Type issues reported at the configured errorLevel

Psalm flags possibly-null references, invalid arguments, or undefined methods at the errorLevel set in psalm.xml.

A stricter level or new code surfaced issues

Lowering errorLevel (stricter) or adding code introduces findings Psalm now reports as errors.

How to fix it

Resolve the reported issues

  1. Read each issue type, file, and line Psalm prints.
  2. Add the missing null guard or correct the argument type.
  3. Re-run psalm until no errors are reported.
Terminal
vendor/bin/psalm --no-progress

Baseline existing issues

Record current issues in a baseline so only new ones fail the build during incremental adoption.

Terminal
vendor/bin/psalm --set-baseline=psalm-baseline.xml

How to prevent it

  • Tighten Psalm errorLevel gradually with a baseline.
  • Fix new findings before they accumulate.
  • Run Psalm locally before pushing to catch issues early.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →