{"record":{"id":"fbf8e8d235809faf","repo":"golang/go","slug":"unknown-pprof-type-s","errorCode":null,"errorMessage":"unknown pprof type %s\n","messagePattern":"unknown pprof type (.+?)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/trace/main.go","lineNumber":126,"sourceCode":"\n\t// Handle requests for profiles.\n\tif *pprofFlag != \"\" {\n\t\tparsed, err := parseTrace(tracef, traceSize)\n\t\tif err != nil {\n\t\t\tlogAndDie(err)\n\t\t}\n\t\tvar f traceviewer.ProfileFunc\n\t\tswitch *pprofFlag {\n\t\tcase \"net\":\n\t\t\tf = pprofByGoroutine(computePprofIO(), parsed)\n\t\tcase \"sync\":\n\t\t\tf = pprofByGoroutine(computePprofBlock(), parsed)\n\t\tcase \"syscall\":\n\t\t\tf = pprofByGoroutine(computePprofSyscall(), parsed)\n\t\tcase \"sched\":\n\t\t\tf = pprofByGoroutine(computePprofSched(), parsed)\n\t\tdefault:\n\t\t\tlogAndDie(fmt.Errorf(\"unknown pprof type %s\\n\", *pprofFlag))\n\t\t}\n\t\trecords, err := f(&http.Request{})\n\t\tif err != nil {\n\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))","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/trace/main.go#L108-L144","documentation":"The `go tool trace` command was invoked with the `-pprof` flag set to a value that is not one of the supported profile types. The tool supports generating four pprof-format profiles from trace data: `net` (network blocking), `sync` (synchronization blocking), `syscall` (syscall blocking), and `sched` (scheduler latency). Any other string passed to `-pprof` triggers this error.","triggerScenarios":"Fires at trace/main.go:125-126 when the `-pprof` flag value doesn't match any of the four cases in the switch statement (net, sync, syscall, sched). The error includes the invalid flag value. `logAndDie` prints the error and exits.","commonSituations":"Typing the profile type incorrectly (e.g., 'network' instead of 'net', 'syscalls' instead of 'syscall'). Using an outdated profile type name from an old Go version. Misspelling the type (e.g., 'synch', 'schd'). Passing 'cpu' or 'heap' which are not valid trace-derived profile types (those come from pprof directly, not trace).","solutions":["Use one of the four valid values: `net`, `sync`, `syscall`, or `sched`.","Check the help output: `go tool trace -h` to see supported flag values.","If you need CPU or heap profiles, use `go tool pprof` directly instead of `go tool trace -pprof`.","For an overview of all trace data, use `go tool trace <file>` without the `-pprof` flag to open the web UI."],"exampleFix":"# Before: invalid pprof type\ngo tool trace -pprof=network trace.out   # wrong\ngo tool trace -pprof=cpu trace.out        # not supported via trace\n\n# After: use a valid type\ngo tool trace -pprof=net trace.out\ngo tool trace -pprof=sync trace.out\ngo tool trace -pprof=syscall trace.out\ngo tool trace -pprof=sched trace.out","handlingStrategy":"validation","validationCode":"// Validate pprof type before passing to go tool trace\nvalidPprofTypes := map[string]bool{\"net\": true, \"sync\": true, \"syscall\": true, \"sched\": true}\npprofType := *pprofFlag\nif !validPprofTypes[pprofType] {\n    log.Fatalf(\"Invalid pprof type '%s'. Valid types: net, sync, syscall, sched\", pprofType)\n}","typeGuard":"// Type guard for valid trace pprof types\nfunc isValidTracePprofType(t string) bool {\n    switch t {\n    case \"net\", \"sync\", \"syscall\", \"sched\":\n        return true\n    default:\n        return false\n    }\n}","tryCatchPattern":null,"preventionTips":["Memorize the four valid -pprof types: net, sync, syscall, sched.","Run `go tool trace -h` to see available options.","For CPU or heap profiles, use go tool pprof directly, not go tool trace -pprof.","Use the web UI (go tool trace file) for interactive exploration instead of specific pprof types."],"tags":["trace","pprof","command-line","flag-validation","runtime-trace"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}