{"record":{"id":"5135593620759851","repo":"golang/go","slug":"invalid-debug-mode-s-want-one-of-parsed-wire","errorCode":null,"errorMessage":"invalid debug mode %s, want one of: parsed, wire, footprint","messagePattern":"invalid debug mode (.+?), want one of: parsed, wire, footprint","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/trace/main.go","lineNumber":148,"sourceCode":"\t\t\tlogAndDie(fmt.Errorf(\"failed to generate pprof: %v\\n\", err))\n\t\t}\n\t\tif err := traceviewer.BuildProfile(records).Write(os.Stdout); err != nil {\n\t\t\tlogAndDie(fmt.Errorf(\"failed to generate pprof: %v\\n\", err))\n\t\t}\n\t\tlogAndDie(nil)\n\t}\n\n\t// Debug flags.\n\tif *debugFlag != \"\" {\n\t\tswitch *debugFlag {\n\t\tcase \"parsed\":\n\t\t\tlogAndDie(debugProcessedEvents(tracef))\n\t\tcase \"wire\":\n\t\t\tlogAndDie(debugRawEvents(tracef))\n\t\tcase \"footprint\":\n\t\t\tlogAndDie(debugEventsFootprint(tracef))\n\t\tdefault:\n\t\t\tlogAndDie(fmt.Errorf(\"invalid debug mode %s, want one of: parsed, wire, footprint\", *debugFlag))\n\t\t}\n\t}\n\n\taddr, err := listenAddr(*httpFlag)\n\tif err != nil {\n\t\tlogAndDie(fmt.Errorf(\"malformed -http value %q: %v\", *httpFlag, err))\n\t}\n\n\tln, err := net.Listen(\"tcp\", addr)\n\tif err != nil {\n\t\tlogAndDie(fmt.Errorf(\"failed to create server socket: %w\", err))\n\t}\n\n\taddr = ln.Addr().String()\n\turl, simplified, err := addrURL(addr)\n\tif err != nil {\n\t\tlogAndDie(fmt.Errorf(\"failed to compute server URL: %v\", err))\n\t}","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/trace/main.go#L130-L166","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n$ go tool trace -d=raw trace.out\n// after\n$ go tool trace -d=wire trace.out","handlingStrategy":"validation","validationCode":"valid := map[string]bool{\"parsed\": true, \"wire\": true, \"footprint\": true}\nif !valid[*debugFlag] {\n    return fmt.Errorf(\"debug must be parsed|wire|footprint, got %q\", *debugFlag)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["cli","go-tool-trace","argument-validation"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}