{"record":{"id":"6c8dbb9ce93ad13d","repo":"golang/go","slug":"s-compilation-command-confusion-q","errorCode":null,"errorMessage":"%s: compilation command confusion %q","messagePattern":"(.+?): compilation command confusion %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/go/internal/work/buildid.go","lineNumber":300,"sourceCode":"\t\t// This is a release. Use this line as the tool ID.\n\t\tid = version\n\t} else {\n\t\t// This is a development version. The first line with\n\t\t// a leading space is the compiler proper.\n\t\tcompiler := \"\"\n\t\tfor _, line := range lines {\n\t\t\tif strings.HasPrefix(line, \" \") && !strings.HasPrefix(line, \" (in-process)\") {\n\t\t\t\tcompiler = line\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif compiler == \"\" {\n\t\t\treturn \"\", \"\", fmt.Errorf(\"%s: can not find compilation command in %q\", name, out)\n\t\t}\n\n\t\tfields, _ := quoted.Split(compiler)\n\t\tif len(fields) == 0 {\n\t\t\treturn \"\", \"\", fmt.Errorf(\"%s: compilation command confusion %q\", name, out)\n\t\t}\n\t\texe = fields[0]\n\t\tif !strings.ContainsAny(exe, `/\\`) {\n\t\t\tif lp, err := pathcache.LookPath(exe); err == nil {\n\t\t\t\texe = lp\n\t\t\t}\n\t\t}\n\t\tid, err = buildid.ReadFile(exe)\n\t\tif err != nil {\n\t\t\treturn \"\", \"\", err\n\t\t}\n\n\t\t// If we can't find a build ID, use a hash.\n\t\tif id == \"\" {\n\t\t\tid = b.fileHash(exe)\n\t\t}\n\t}\n","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/work/buildid.go#L282-L318","documentation":"gccToolIDPrefix found the indented compiler-command line in experimental -### output, but quoted.Split on that line yielded zero fields. This means the line consists only of whitespace/quotes that the splitter couldn't tokenize — an invariant violation in the compiler's output format.","triggerScenarios":"An experimental gcc/gccgo whose expanded command line is empty or malformed (e.g. just a stray quote or whitespace). Extremely rare; indicates a broken or non-standard compiler driver.","commonSituations":"A patched gcc that emits an empty expanded command; a wrapper that strips all tokens but leaves the line prefix; concurrent truncation of the captured output.","solutions":["Capture the raw -### output and inspect the indented line that should hold the command.","Use a release gcc/gccgo rather than a patched/experimental one.","Report the malformed output to the Go issue tracker.","Temporarily set -compiler=gc if gccgo isn't required."],"exampleFix":"// before\n$ GCCGO=/opt/gccgo-patched/bin/gccgo go build -compiler=gccgo ./...\n// error: /opt/gccgo-patched/bin/gccgo: compilation command confusion \"...\"\n\n// after\n$ GCCGO=gccgo go build -compiler=gccgo ./...\n# or diagnose: /opt/gccgo-patched/bin/gccgo -### -x go -c -","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat 'compilation command confusion' as a signal the compiler driver is non-standard.","Switch to a release gcc/gccgo.","Report malformed -### output upstream rather than working around it long-term."],"tags":["gccgo","cgo","toolchain","compiler-detection"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}