{"record":{"id":"d02fd9e362491d55","repo":"cockroachdb/cockroach","slug":"must-supply-out","errorCode":null,"errorMessage":"must supply -out","messagePattern":"must supply -out","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/run-pgo-build/main.go","lineNumber":60,"sourceCode":"\t\t}\n\t\tfor i := range prof.Sample {\n\t\t\t// Drop labels, which are not used by pprof but can inflate the profile\n\t\t\t// size significantly.\n\t\t\tprof.Sample[i].Label = nil\n\t\t}\n\t\tprofiles = append(profiles, prof.Compact())\n\t}\n\tif len(profiles) == 0 {\n\t\treturn nil, errors.Errorf(\"no profiles found\")\n\t}\n\treturn profile.Merge(profiles)\n}\n\nfunc main() {\n\tflag.Parse()\n\n\tif *outFile == \"\" {\n\t\tpanic(\"must supply -out\")\n\t}\n\n\tvar readWg sync.WaitGroup\n\treadWg.Add(1)\n\tprofilesChan := make(chan *profile.Profile)\n\tdefer readWg.Wait()\n\tdefer close(profilesChan)\n\n\tgo func() {\n\t\tdefer readWg.Done()\n\t\tres, err := processProfiles(profilesChan)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tw, err := os.Create(*outFile)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/cockroachdb/cockroach/blob/8812064a015d2faf99d3fc7e15880f94042954b0/pkg/cmd/run-pgo-build/main.go#L42-L78","documentation":"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.","triggerScenarios":"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.","commonSituations":"Developers regenerating default.pgo files manually after collecting profiles; wrapper scripts updated to add new flags that accidentally dropped -out.","solutions":["Supply the output path: -out=pkg/sql/default.pgo (wherever the merged profile is consumed)","Check the bazel target/script that wraps run-pgo-build still forwards -out"],"exampleFix":"# before\n./run-pgo-build profile1.pprof profile2.pprof\n\n# after\n./run-pgo-build -out=pkg/sql/default.pgo profile1.pprof profile2.pprof","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Wrap run-pgo-build in a script that always sets -out","Fail fast in wrappers when required flags are missing rather than relying on the binary's panic"],"tags":["build","pgo","cli-usage","go"],"backgroundTag":null,"analyzedSha":"8812064a015d2faf99d3fc7e15880f94042954b0","analyzedAt":"2026-08-15T16:34:17.351Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}