cockroachdb/cockroach · error

must supply -out

Error message

must supply -out

What it means

run-pgo-build is the dev tool that merges collected PGO profiles into a default.pgo file. main() panics with 'must supply -out' immediately after flag.Parse() when the required -out flag is empty — a pure usage guard; no profiles are read and nothing else runs.

Source

Thrown at pkg/cmd/run-pgo-build/main.go:60

		}
		for i := range prof.Sample {
			// Drop labels, which are not used by pprof but can inflate the profile
			// size significantly.
			prof.Sample[i].Label = nil
		}
		profiles = append(profiles, prof.Compact())
	}
	if len(profiles) == 0 {
		return nil, errors.Errorf("no profiles found")
	}
	return profile.Merge(profiles)
}

func main() {
	flag.Parse()

	if *outFile == "" {
		panic("must supply -out")
	}

	var readWg sync.WaitGroup
	readWg.Add(1)
	profilesChan := make(chan *profile.Profile)
	defer readWg.Wait()
	defer close(profilesChan)

	go func() {
		defer readWg.Done()
		res, err := processProfiles(profilesChan)
		if err != nil {
			panic(err)
		}
		w, err := os.Create(*outFile)
		if err != nil {
			panic(err)
		}

View on GitHub (pinned to 8812064a01)

Solutions

  1. Supply the output path: -out=pkg/sql/default.pgo (wherever the merged profile is consumed)
  2. Check the bazel target/script that wraps run-pgo-build still forwards -out

Example fix

# before
./run-pgo-build profile1.pprof profile2.pprof

# after
./run-pgo-build -out=pkg/sql/default.pgo profile1.pprof profile2.pprof
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Invoking the run-pgo-build binary without -out=<path>, e.g. a hand-run command or a bazel/script wrapper that stopped passing the flag after refactoring.

Common situations: Developers regenerating default.pgo files manually after collecting profiles; wrapper scripts updated to add new flags that accidentally dropped -out.

Related errors


AI-assisted analysis of cockroachdb/cockroach@8812064a01 (2026-08-15). Data as JSON: /api/errors/d02fd9e362491d55. Report an issue: GitHub.