vitessio/vitess · error

unsupported profile mode

Error message

unsupported profile mode

What it means

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.

Source

Thrown at go/vt/servenv/pprof.go:302

			trace.Stop()
			pf.Close()
		})
		return start, stop

	case profileGoroutine:
		start = startCallback(func() {
			pf = prof.mkprofile()
		})
		stop = stopCallback(func() {
			if mp := pprof.Lookup("goroutine"); mp != nil {
				mp.WriteTo(pf, 0)
			}
			pf.Close()
		})
		return start, stop

	default:
		panic("unsupported profile mode")
	}
}

func init() {
	OnParse(func(fs *pflag.FlagSet) {
		fs.BoolVar(&httpPprof, "pprof-http", httpPprof, "enable pprof http endpoints")
		fs.StringSliceVar(&pprofFlag, "pprof", pprofFlag, "enable profiling")
	})
	OnInit(pprofInit)
	OnInit(HTTPRegisterProfile)
}

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Use a supported profile mode value (e.g. cpu, heap, block, mutex, goroutine, threadcreate)
  2. Check the exact flag spelling in the --help output for the binary you are running
  3. If you need a new profile mode, extend the switch in servenv/pprof.go rather than passing an arbitrary string

Example fix

// before
vtcombo --profile cpuprofile
// after
vtcombo --profile cpu
Defensive patterns

Strategy: validation

Validate before calling

var validModes = map[string]bool{"cpu":true,"heap":true,"block":true,"mutex":true,"goroutine":true,"threadcreate":true}
if !validModes[profileMode] { return fmt.Errorf("unsupported profile mode %q", profileMode) }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "unknown output mode", "invalid value for flag", "expects true/false": fixing invalid flag value errors in CLI tools — this error's family across 24 libraries.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/58e05555abeaa453. Report an issue: GitHub.