Skip to content
Latchkey

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 test output
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/abc123

Common 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.

Terminal
go test -run '^$' -fuzz '^FuzzParse$' -fuzztime 60s ./parser

Run 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.

Terminal
go test ./parser          # runs seed corpus, no open-ended fuzzing
go test -fuzz=Fuzz -fuzztime 60s ./parser   # dedicated fuzz stage

Fix and commit the failing input

  1. Reproduce with the written testdata/fuzz/... input (Go re-runs it automatically).
  2. Fix the bug the fuzzer found.
  3. Commit the failing input so it becomes a permanent regression seed.

How to prevent it

  • Always pass -fuzztime in CI so fuzzing has a stopping point.
  • Target one fuzz function per -fuzz invocation.
  • Run the seed corpus on every build; reserve open-ended fuzzing for a dedicated stage.

Frequently asked questions

What causes ""-fuzz" failures"?
-fuzz must select exactly one fuzz function. A broad pattern that matches several is rejected.
How do I fix "-fuzz" failures?
Select a single target and cap the run so CI does not hang.
Can Latchkey fix this automatically?
Yes. Latchkey runs your GitHub Actions on managed runners that detect this failure, apply the fix, and retry the job automatically - self-healing is on by default.

Related guides

References

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