Go "go test -fuzz" Failures - Fix Fuzzing Errors in CI
go test -fuzz runs a fuzz target to search for failing inputs. In CI it fails when -fuzz matches more than one target, when a seed corpus entry already fails, or when no -fuzztime is set and the run fuzzes indefinitely until the job times out.
What this error means
A fuzz step fails with will not fuzz, -fuzz matches more than one fuzz test, reports a failing input written to testdata/fuzz/, or hangs until the CI job is killed because fuzzing has no built-in stopping point without -fuzztime.
go: will not fuzz, -fuzz matches more than one fuzz test: [FuzzParse FuzzDecode]
# or a discovered failure:
--- FAIL: FuzzParse (0.30s)
failing input written to testdata/fuzz/FuzzParse/abc123Common causes
-fuzz matches multiple targets
-fuzz must select exactly one fuzz function. A broad pattern that matches several is rejected.
A seed-corpus or discovered input fails
A seed in testdata/fuzz/ (or a newly found input) triggers the target’s failure, which is a real bug the fuzzer surfaced.
No fuzz time limit set
Without -fuzztime, -fuzz runs until interrupted, so a CI job fuzzes until it hits the runner timeout.
How to fix it
Fuzz one target with a bounded time
Select a single target and cap the run so CI does not hang.
go test -run '^$' -fuzz '^FuzzParse$' -fuzztime 60s ./parserRun the seed corpus as regression tests by default
Without -fuzz, go test still runs the seed corpus, catching known failing inputs cheaply on every CI run.
go test ./parser # runs seed corpus, no open-ended fuzzing
go test -fuzz=Fuzz -fuzztime 60s ./parser # dedicated fuzz stageFix and commit the failing input
- Reproduce with the written
testdata/fuzz/...input (Go re-runs it automatically). - Fix the bug the fuzzer found.
- Commit the failing input so it becomes a permanent regression seed.
How to prevent it
- Always pass
-fuzztimein CI so fuzzing has a stopping point. - Target one fuzz function per
-fuzzinvocation. - Run the seed corpus on every build; reserve open-ended fuzzing for a dedicated stage.