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

  1. Re-run with one of exactly: `go tool trace -d=parsed <trace>`, `-d=wire <trace>`, or `-d=footprint <trace>`.
  2. 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.
  3. 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

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


AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12). Data as JSON: /api/errors/5135593620759851. Report an issue: GitHub.