{"record":{"id":"cf491ac5a2f7e7b0","repo":"golang/go","slug":"action-contains-multiple-pgo-profile-dependencies","errorCode":null,"errorMessage":"action contains multiple PGO profile dependencies","messagePattern":"action contains multiple PGO profile dependencies","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/go/internal/work/exec.go","lineNumber":844,"sourceCode":"\t\tembed.Files = make(map[string]string)\n\t\tfor _, file := range p.EmbedFiles {\n\t\t\tembed.Files[file] = fsys.Actual(filepath.Join(p.Dir, file))\n\t\t}\n\t\tjs, err := json.MarshalIndent(&embed, \"\", \"\\t\")\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"marshal embedcfg: %v\", err)\n\t\t}\n\t\tembedcfg = js\n\t}\n\n\t// Find PGO profile if needed.\n\tvar pgoProfile string\n\tfor _, a1 := range a.Deps {\n\t\tif a1.Mode != \"preprocess PGO profile\" {\n\t\t\tcontinue\n\t\t}\n\t\tif pgoProfile != \"\" {\n\t\t\treturn fmt.Errorf(\"action contains multiple PGO profile dependencies\")\n\t\t}\n\t\tpgoProfile = a1.built\n\t}\n\n\tvar coverageConfig string\n\tif coverPr != nil {\n\t\tcoverageConfig = coverPr.coverageConfig\n\t}\n\n\tif p.Internal.BuildInfo != nil && cfg.ModulesEnabled {\n\t\tprog := modload.ModInfoProg(p.Internal.BuildInfo.String(), cfg.BuildToolchainName == \"gccgo\")\n\t\tif len(prog) > 0 {\n\t\t\tif err := sh.writeFile(objdir+\"_gomod_.go\", prog); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tgofiles = append(gofiles, objdir+\"_gomod_.go\")\n\t\t}\n\t}","sourceCodeStart":826,"sourceCodeEnd":862,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/work/exec.go#L826-L862","documentation":"When executing a build action, the go tool walks a.Deps for entries whose Mode is \"preprocess PGO profile\". At most one such dependency is expected per action; this fires when a second is found, indicating the action graph was constructed with duplicate PGO-profile dependencies. It is an internal invariant violation in the build-action planner, not caused by ordinary source or flag input.","triggerScenarios":"Fires in (b *Builder).build inside the `for _, a1 := range a.Deps` loop when pgoProfile is already non-empty and another a1.Mode == \"preprocess PGO profile\" is encountered.","commonSituations":"Unusual combinations of -pgo flags, a module with multiple default.pgo files resolved by the loader, or a toolchain bug in action-graph construction. Very rare in normal PGO workflows.","solutions":["Build with -pgo=off to confirm the issue is PGO-specific","Ensure the module has at most one default.pgo file (check the package directory and replace directives)","Report as a Go toolchain bug with the module layout and exact build flags"],"exampleFix":"// before\ngo build -pgo=auto ./...\n// after (isolate the cause)\ngo build -pgo=off ./...","handlingStrategy":"validation","validationCode":"// Confirm at most one PGO profile before a -pgo build\nmatches, _ := filepath.Glob(\"*.pgo\")\nif len(matches) > 1 {\n    return fmt.Errorf(\"multiple pgo files present: %v\", matches)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep at most one default.pgo in the module root","Use -pgo=off when profile-guided optimization is not needed","Pin the Go version so action-graph behavior is stable"],"tags":["go-toolchain","pgo","build-action-graph","internal-error"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:31:55.035Z"}