{"record":{"id":"d3c40c848a9552ae","repo":"golang/go","slug":"reading-srcfiles-list-w","errorCode":null,"errorMessage":"reading srcfiles list: %w","messagePattern":"reading srcfiles list: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/go/internal/work/exec.go","lineNumber":1378,"sourceCode":"\t}\n\n\tpr := &runCgoProvider{\n\t\tCFLAGS:                          replaceAll(cached.CFLAGS, \"$OBJDIR/\", a.Objdir),\n\t\tCXXFLAGS:                        replaceAll(cached.CXXFLAGS, \"$OBJDIR/\", a.Objdir),\n\t\tFFLAGS:                          replaceAll(cached.FFLAGS, \"$OBJDIR/\", a.Objdir),\n\t\tLDFLAGS:                         replaceAll(cached.LDFLAGS, \"$OBJDIR/\", a.Objdir),\n\t\tnotCompatibleForInternalLinking: cached.NotCompatibleForInternalLinking,\n\t\tgoFiles:                         goFilesObjdir,\n\t}\n\n\treturn pr, nil\n}\n\nfunc (b *Builder) loadCachedSrcFiles(a *Action) ([]string, error) {\n\tc := cache.Default()\n\tlist, _, err := cache.GetBytes(c, cache.Subkey(a.actionID, \"srcfiles\"))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"reading srcfiles list: %w\", err)\n\t}\n\tvar srcfiles []string\n\tfor name := range strings.SplitSeq(string(list), \"\\n\") {\n\t\tif name == \"\" { // end of list\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasPrefix(name, \"./\") {\n\t\t\tsrcfiles = append(srcfiles, name[2:])\n\t\t\tcontinue\n\t\t}\n\t\tif err := b.loadCachedObjdirFile(a, c, name); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsrcfiles = append(srcfiles, a.Objdir+name)\n\t}\n\treturn srcfiles, nil\n}\n","sourceCodeStart":1360,"sourceCodeEnd":1396,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/work/exec.go#L1360-L1396","documentation":"loadCachedSrcFiles reads the \"srcfiles\" subkey from the build cache, a newline-separated manifest of a cached action's source files. If cache.GetBytes fails, the error wraps the cause. This only fires on the cache-hit path, meaning the build believed a cached result existed but could not retrieve its source-file list.","triggerScenarios":"Fires in loadCachedSrcFiles when cache.GetBytes(c, cache.Subkey(a.actionID, \"srcfiles\")) errors, while vet or build reconstruction needs the source list of a cached package.","commonSituations":"Partially-written cache entries, GOCACHE on NFS/FUSE, concurrent cache writers, or `go clean` running in parallel with a build.","solutions":["Run `go clean -cache` then rebuild","Move GOCACHE to a reliable local filesystem","Prevent concurrent processes from modifying the cache"],"exampleFix":"// before\ngo build ./...\n// after\ngo clean -cache && go build ./...","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Treat srcfiles cache errors as recoverable: clean and rebuild\nif bytes.Contains(out, []byte(\"reading srcfiles list\")) {\n    exec.Command(\"go\", \"clean\", \"-cache\").Run()\n    out, err = cmd.CombinedOutput()\n}","preventionTips":["Keep GOCACHE on a reliable local filesystem","Do not run `go clean` during a build","Pin GOCACHE to a stable absolute path","Avoid sharing one cache across parallel CI jobs unless the cache is concurrency-safe"],"tags":["go-toolchain","build-cache","io","vet"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}