{"record":{"id":"27f319e0873c8105","repo":"golang/go","slug":"expected-marker-but-found-q-recompile-packag","errorCode":null,"errorMessage":"expected $$ marker, but found %q (recompile package)","messagePattern":"expected \\$\\$ marker, but found %q \\(recompile package\\)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/compile/internal/noder/import.go","lineNumber":278,"sourceCode":"\t// as a single large string. This reduces heap fragmentation and\n\t// allows returning individual substrings very efficiently.\n\tvar mapped string\n\tmapped, err = base.MapFile(r.File(), pos, end-pos)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t// check for end-of-section marker \"\\n$$\\n\" and remove it\n\tconst marker = \"\\n$$\\n\"\n\n\tvar ok bool\n\tdata, ok = strings.CutSuffix(mapped, marker)\n\tif !ok {\n\t\tcutoff := data // include last 10 bytes in error message\n\t\tif len(cutoff) >= 10 {\n\t\t\tcutoff = cutoff[len(cutoff)-10:]\n\t\t}\n\t\terr = fmt.Errorf(\"expected $$ marker, but found %q (recompile package)\", cutoff)\n\t\treturn\n\t}\n\n\treturn\n}\n\n// addFingerprint reads the linker fingerprint included at the end of\n// the exportdata.\nfunc addFingerprint(path string, data string) error {\n\tvar fingerprint goobj.FingerprintType\n\n\tpos := len(data) - len(fingerprint)\n\tif pos < 0 {\n\t\treturn fmt.Errorf(\"missing linker fingerprint in exportdata, but found %q\", data)\n\t}\n\tbuf := []byte(data[pos:])\n\n\tcopy(fingerprint[:], buf)","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/compile/internal/noder/import.go#L260-L296","documentation":"Returned when the mapped export-data buffer does not end with the \"\\n$$\\n\" section marker that delimits Go export data. strings.CutSuffix fails, the last up-to-10 bytes are captured, and the message tells the user to recompile the package — the object file is truncated or from an incompatible format.","triggerScenarios":"After reading and mapping the export data section, strings.CutSuffix(mapped, \"\\n$$\\n\") returns ok=false because the marker is absent; the trailing bytes are shown as evidence.","commonSituations":"Truncated or partial object file (build killed mid-write), object file from a much older/newer Go that uses a different export-data framing, corrupted build cache entry, or a hand-edited object/archive.","solutions":["Recompile the named package: go build <pkg> or go build -a <pkg>.","go clean -cache to discard all suspect export data.","Confirm the toolchain version is consistent across the build (go env GOROOT GOTOOLCHAIN).","If it persists, capture the object file and report a Go bug with the toolchain versions involved."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Treat missing $$ marker as stale and force a rebuild.\nif !strings.HasSuffix(mapped, \"\\n$$\\n\") {\n    os.Remove(objectFile) // force recompile\n    return rebuild(pkg)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid interrupting builds mid-write (use go build, not hand-stitched object archives).","go clean -cache after toolchain upgrades."],"tags":["go-compiler","export-data","toolchain-mismatch","corruption"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}