golang/go · error
reading srcfiles list: %w
Error message
reading srcfiles list: %w
What it means
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.
Source
Thrown at src/cmd/go/internal/work/exec.go:1378
}
pr := &runCgoProvider{
CFLAGS: replaceAll(cached.CFLAGS, "$OBJDIR/", a.Objdir),
CXXFLAGS: replaceAll(cached.CXXFLAGS, "$OBJDIR/", a.Objdir),
FFLAGS: replaceAll(cached.FFLAGS, "$OBJDIR/", a.Objdir),
LDFLAGS: replaceAll(cached.LDFLAGS, "$OBJDIR/", a.Objdir),
notCompatibleForInternalLinking: cached.NotCompatibleForInternalLinking,
goFiles: goFilesObjdir,
}
return pr, nil
}
func (b *Builder) loadCachedSrcFiles(a *Action) ([]string, error) {
c := cache.Default()
list, _, err := cache.GetBytes(c, cache.Subkey(a.actionID, "srcfiles"))
if err != nil {
return nil, fmt.Errorf("reading srcfiles list: %w", err)
}
var srcfiles []string
for name := range strings.SplitSeq(string(list), "\n") {
if name == "" { // end of list
continue
}
if strings.HasPrefix(name, "./") {
srcfiles = append(srcfiles, name[2:])
continue
}
if err := b.loadCachedObjdirFile(a, c, name); err != nil {
return nil, err
}
srcfiles = append(srcfiles, a.Objdir+name)
}
return srcfiles, nil
}
View on GitHub (pinned to b6b368adc5)
Solutions
- Run `go clean -cache` then rebuild
- Move GOCACHE to a reliable local filesystem
- Prevent concurrent processes from modifying the cache
Example fix
// before go build ./... // after go clean -cache && go build ./...
Defensive patterns
Strategy: retry
Try / catch
// Treat srcfiles cache errors as recoverable: clean and rebuild
if bytes.Contains(out, []byte("reading srcfiles list")) {
exec.Command("go", "clean", "-cache").Run()
out, err = cmd.CombinedOutput()
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Partially-written cache entries, GOCACHE on NFS/FUSE, concurrent cache writers, or `go clean` running in parallel with a build.
Related errors
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/d3c40c848a9552ae.
Report an issue: GitHub.