Skip to content
Latchkey

go test "failing input written to testdata/fuzz" in CI

When go test -fuzz finds an input that makes the fuzz target fail or panic, it writes that input to testdata/fuzz/<FuzzName>/ and fails the run so the case becomes a permanent regression test.

What this error means

go test with -fuzz fails with a panic or assertion and prints "Failing input written to testdata/fuzz/FuzzX/..." plus a command to re-run that single case.

go test
--- FAIL: FuzzParse (0.05s)
    Failing input written to testdata/fuzz/FuzzParse/582d...
    To re-run:
    go test -run=FuzzParse/582d...

Common causes

The fuzzer found a real bug

The target crashed or violated an assertion on a generated input, which Go saved so the failure reproduces deterministically.

An unhandled edge case in the code under test

Empty, malformed, or boundary inputs reach a code path that panics or returns the wrong result.

How to fix it

Reproduce and fix the saved input

  1. Run the printed go test -run=FuzzName/<id> command to reproduce the single failing case.
  2. Fix the code so it handles that input.
  3. Commit the new testdata/fuzz corpus entry so the case is checked forever.
Terminal
go test -run='FuzzParse/582d' ./...

Keep fuzzing bounded in CI

Run a time-boxed fuzz pass in CI so it surfaces regressions without running forever.

Terminal
go test -run=Fuzz -fuzz=FuzzParse -fuzztime=60s ./...

How to prevent it

  • Commit failing inputs from testdata/fuzz as permanent regression seeds.
  • Run a short -fuzztime pass in CI to catch new crashers.
  • Handle empty and boundary inputs explicitly in parsers.

Frequently asked questions

What causes ""failing input written to testdata/fuzz""?
The target crashed or violated an assertion on a generated input, which Go saved so the failure reproduces deterministically.
How do I fix "failing input written to testdata/fuzz"?
Reproduce and fix the saved input

Related guides

References

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