Snapshot or golden-file mismatch

A test compared current output against a committed snapshot or golden file and found a difference.

snapshot-mismatch low confidence test

Matched signals

  • snapshot does not match
  • snapshot mismatch
  • stored snapshot
  • received value does not match stored snapshot
  • golden file mismatch
  • does not match the expected snapshot
  • update snapshots
  • toMatchSnapshot

Snapshot or golden-file mismatch

What this failure means

A test compared current output against a committed snapshot or golden file and found a difference.

Symptoms

Faultline looks for one or more of these log fragments:

snapshot does not match
snapshot mismatch
stored snapshot
received value does not match stored snapshot
golden file mismatch
does not match the expected snapshot
update snapshots
toMatchSnapshot

Diagnosis

A test compared current output against a committed snapshot or golden file and found a difference.

The behavior may have changed intentionally without regenerating the snapshot, or the output may now depend on unstable ordering, timestamps, or environment details.

Fix steps

  1. Inspect the diff between the current output and the stored snapshot to decide whether the behavior change is expected.
  2. If the new output is correct, regenerate and commit the updated snapshots or golden files.
  3. If the diff is unstable, remove nondeterministic fields such as timestamps, UUIDs, or map iteration order before snapshotting.
  4. Re-run the specific test locally to confirm the output is stable across repeated runs.

Validation

  • Re-run the affected test after updating the snapshot or normalizing unstable output.
  • Confirm the test passes repeatedly with the same output.

Why it matters

Snapshot failures can reflect either a real behavior change or hidden nondeterminism. Treating them casually makes it easy to bless unstable output into the test suite.

Prevention

  • Keep snapshot inputs deterministic and normalize unstable fields before writing expected output.
  • Review snapshot diffs carefully in pull requests instead of auto-accepting them.
  • Prefer narrow golden files that capture only the behavior that matters.
  • Store snapshot update commands in the test docs or Makefile so regenerating expected output is consistent across contributors.

Try it locally

go test ./...
go test ./...

How Faultline detects it

Use faultline explain snapshot-mismatch to see the full playbook.

faultline analyze build.log
faultline explain snapshot-mismatch

Generated from playbooks/bundled/log/test/snapshot-mismatch.yaml. Do not edit directly.

Try it on your own failed log

$ faultline analyze failed.log
Want this across every CI run? Faultline Teams tracks recurring failures across all your repos and surfaces patterns in a shared dashboard.