{"record":{"id":"8a1a4002ea88fdad","repo":"golang/go","slug":"go-s-s-s-v","errorCode":null,"errorMessage":"go %s%s%s: %v","messagePattern":"go %s%s%s: %v","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/go/internal/work/exec.go","lineNumber":2199,"sourceCode":"\n\t// TODO(rsc): There is a missing updateBuildID here,\n\t// but we have to decide where to store the build ID in these files.\n\ta.built = a.Target\n\treturn BuildToolchain.ldShared(b, a, a.Deps[0].Deps, a.Target, importcfg, a.Deps)\n}\n\n// BuildInstallFunc is the action for installing a single package or executable.\nfunc BuildInstallFunc(b *Builder, ctx context.Context, a *Action) (err error) {\n\tdefer func() {\n\t\tif err != nil {\n\t\t\t// a.Package == nil is possible for the go install -buildmode=shared\n\t\t\t// action that installs libmangledname.so, which corresponds to\n\t\t\t// a list of packages, not just one.\n\t\t\tsep, path := \"\", \"\"\n\t\t\tif a.Package != nil {\n\t\t\t\tsep, path = \" \", a.Package.ImportPath\n\t\t\t}\n\t\t\terr = fmt.Errorf(\"go %s%s%s: %v\", cfg.CmdName, sep, path, err)\n\t\t}\n\t}()\n\tsh := b.Shell(a)\n\n\ta1 := a.Deps[0]\n\ta.buildID = a1.buildID\n\tif a.json != nil {\n\t\ta.json.BuildID = a.buildID\n\t}\n\n\t// If we are using the eventual install target as an up-to-date\n\t// cached copy of the thing we built, then there's no need to\n\t// copy it into itself (and that would probably fail anyway).\n\t// In this case a1.built == a.Target because a1.built == p.Target,\n\t// so the built target is not in the a1.Objdir tree that b.cleanup(a1) removes.\n\tif a1.built == a.Target {\n\t\ta.built = a.Target\n\t\tif !a.buggyInstall {","sourceCodeStart":2181,"sourceCodeEnd":2217,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/work/exec.go#L2181-L2217","documentation":"BuildInstallFunc wraps any error from the install action with the command name (cfg.CmdName, e.g. \"build\" or \"install\"), a separator, and the package import path. It is a user-facing prefix that contextualizes the underlying failure; the real cause is in the wrapped %v. For the -buildmode=shared action that installs a .so over multiple packages, a.Package is nil so the path is omitted.","triggerScenarios":"Fires in the deferred error handler of BuildInstallFunc whenever err != nil after the install action body - covering link errors, copy errors, permission errors, or any downstream build failure.","commonSituations":"Any `go install` or `go build` failure - the wrapped %v is the actionable part (missing dependency, compile error, permission denied, link failure).","solutions":["Read the wrapped error text after the colon - that is the real cause","Address the underlying failure (missing module, compile error, permissions)","Re-run with -x for full action tracing: `go install -x <pkg>`"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Unwrap the 'go <cmd> <pkg>: <cause>' wrapper to get the real error\nout, err := cmd.CombinedOutput()\nif err != nil {\n    // The real cause follows the last ': ' in the first error line\n    if i := bytes.LastIndex(out, []byte(\": \")); i >= 0 {\n        log.Printf(\"underlying cause: %s\", out[i+2:])\n    }\n    return err\n}","preventionTips":["Always read the text after the colon - that is the actionable cause","Use `go install -x` to trace which action failed","Run `go build` before `go install` to separate compile from install failures"],"tags":["go-toolchain","install","error-wrapper","user-facing"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:31:55.035Z"}