golang/go · error
invalid debug mode %s, want one of: parsed, wire, footprint
Error message
invalid debug mode %s, want one of: parsed, wire, footprint
What it means
The `go tool trace` command's `-d` (debug) flag only accepts three literal modes: "parsed", "wire", and "footprint". Any other string passed to it falls through the switch in main and is rejected before any trace processing begins. This is a CLI usage guard, not a trace-content error.
Source
Thrown at src/cmd/trace/main.go:148
logAndDie(fmt.Errorf("failed to generate pprof: %v\n", err))
}
if err := traceviewer.BuildProfile(records).Write(os.Stdout); err != nil {
logAndDie(fmt.Errorf("failed to generate pprof: %v\n", err))
}
logAndDie(nil)
}
// Debug flags.
if *debugFlag != "" {
switch *debugFlag {
case "parsed":
logAndDie(debugProcessedEvents(tracef))
case "wire":
logAndDie(debugRawEvents(tracef))
case "footprint":
logAndDie(debugEventsFootprint(tracef))
default:
logAndDie(fmt.Errorf("invalid debug mode %s, want one of: parsed, wire, footprint", *debugFlag))
}
}
addr, err := listenAddr(*httpFlag)
if err != nil {
logAndDie(fmt.Errorf("malformed -http value %q: %v", *httpFlag, err))
}
ln, err := net.Listen("tcp", addr)
if err != nil {
logAndDie(fmt.Errorf("failed to create server socket: %w", err))
}
addr = ln.Addr().String()
url, simplified, err := addrURL(addr)
if err != nil {
logAndDie(fmt.Errorf("failed to compute server URL: %v", err))
}View on GitHub (pinned to b6b368adc5)
Solutions
- Re-run with one of exactly: `go tool trace -d=parsed <trace>`, `-d=wire <trace>`, or `-d=footprint <trace>`.
- Run `go tool trace -h` (or check the source switch at src/cmd/trace/main.go:148) to confirm the accepted spellings for your Go version.
- Drop the `-d` flag entirely if you only want the default HTTP viewer — debug modes are optional diagnostics.
Example fix
// before $ go tool trace -d=raw trace.out // after $ go tool trace -d=wire trace.out
Defensive patterns
Strategy: validation
Validate before calling
valid := map[string]bool{"parsed": true, "wire": true, "footprint": true}
if !valid[*debugFlag] {
return fmt.Errorf("debug must be parsed|wire|footprint, got %q", *debugFlag)
} Prevention
- Wrap the go tool trace invocation in a script that validates the -d value from an enum.
- Keep a cheat-sheet of accepted modes next to the command in your README.
When it happens
Trigger: Running `go tool trace -d=<value>` (or `-d <value>`) where <value> is not exactly parsed/wire/footprint. Common typos: `parsedd`, `wire-format`, `footprints`, `raw`, `debug`, or passing `--debug=parsed` style with a leading dash confusion.
Common situations: Misremembering the flag name; copy-pasting a debug value from an old blog post that referenced a different/newer mode; tab-completion inserting a wrong word; shell aliasing mangling the argument.
Related errors
- malformed -http value %q: %v
- tool %q is ambiguous; choose one of:
- no trace file supplied
- lzw: unknown order
- lzw: input byte too large for the litWidth
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/5135593620759851.
Report an issue: GitHub.