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.
--- 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
- Run the printed
go test -run=FuzzName/<id>command to reproduce the single failing case. - Fix the code so it handles that input.
- Commit the new
testdata/fuzzcorpus entry so the case is checked forever.
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.
go test -run=Fuzz -fuzz=FuzzParse -fuzztime=60s ./...How to prevent it
- Commit failing inputs from
testdata/fuzzas permanent regression seeds. - Run a short
-fuzztimepass in CI to catch new crashers. - Handle empty and boundary inputs explicitly in parsers.