{"record":{"id":"58e05555abeaa453","repo":"vitessio/vitess","slug":"unsupported-profile-mode","errorCode":null,"errorMessage":"unsupported profile mode","messagePattern":"unsupported profile mode","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/servenv/pprof.go","lineNumber":302,"sourceCode":"\t\t\ttrace.Stop()\n\t\t\tpf.Close()\n\t\t})\n\t\treturn start, stop\n\n\tcase profileGoroutine:\n\t\tstart = startCallback(func() {\n\t\t\tpf = prof.mkprofile()\n\t\t})\n\t\tstop = stopCallback(func() {\n\t\t\tif mp := pprof.Lookup(\"goroutine\"); mp != nil {\n\t\t\t\tmp.WriteTo(pf, 0)\n\t\t\t}\n\t\t\tpf.Close()\n\t\t})\n\t\treturn start, stop\n\n\tdefault:\n\t\tpanic(\"unsupported profile mode\")\n\t}\n}\n\nfunc init() {\n\tOnParse(func(fs *pflag.FlagSet) {\n\t\tfs.BoolVar(&httpPprof, \"pprof-http\", httpPprof, \"enable pprof http endpoints\")\n\t\tfs.StringSliceVar(&pprofFlag, \"pprof\", pprofFlag, \"enable profiling\")\n\t})\n\tOnInit(pprofInit)\n\tOnInit(HTTPRegisterProfile)\n}\n","sourceCodeStart":284,"sourceCodeEnd":314,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/servenv/pprof.go#L284-L314","documentation":"The pprof profiling setup selects a profile mode (cpu, heap, block, mutex, threadcreate, goroutine etc.) via a switch; a mode value outside the known set reaches the default branch and panics. This catches invalid profile-mode configuration early at init/parse time.","triggerScenarios":"Setting the profile flag (--profile or internal profileMode variable) to a mode string the pprof module does not recognize; programmatic code assigning an unsupported profile mode before the pprof start function is built.","commonSituations":"Typo in the profile mode flag value (e.g. 'cpuprofile' instead of 'cpu'); new profile modes added in one vitess version but an old binary/other code path supplies an unsupported value; custom startup scripts with a mistyped flag.","solutions":["Use a supported profile mode value (e.g. cpu, heap, block, mutex, goroutine, threadcreate)","Check the exact flag spelling in the --help output for the binary you are running","If you need a new profile mode, extend the switch in servenv/pprof.go rather than passing an arbitrary string"],"exampleFix":"// before\nvtcombo --profile cpuprofile\n// after\nvtcombo --profile cpu","handlingStrategy":"validation","validationCode":"var validModes = map[string]bool{\"cpu\":true,\"heap\":true,\"block\":true,\"mutex\":true,\"goroutine\":true,\"threadcreate\":true}\nif !validModes[profileMode] { return fmt.Errorf(\"unsupported profile mode %q\", profileMode) }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check --help for supported profile mode values","Validate flag values in wrapper scripts before launching binaries","Keep profile flags in sync across vitess version upgrades"],"tags":["go","panic","pprof","profiling","flags"],"backgroundTag":"invalid-flag-value","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}