golang/go · error · entryNotFoundError
entry file incomplete
Error message
entry file incomplete
What it means
The entry file was partially read — io.ReadFull returned ErrUnexpectedEOF with fewer than entrySize bytes. The file exists and has some content (1 to entrySize-1 bytes) but was truncated before reaching the minimum valid entry size. This is distinct from the empty-file case: there is data, just not enough.
Source
Thrown at src/cmd/go/internal/cache/cache.go:219
func (c *DiskCache) get(id ActionID) (Entry, error) {
missing := func(reason error) (Entry, error) {
return Entry{}, &entryNotFoundError{Err: reason}
}
f, err := os.Open(c.fileName(id, "a"))
if err != nil {
return missing(err)
}
defer f.Close()
entry := make([]byte, entrySize+1) // +1 to detect whether f is too long
if n, err := io.ReadFull(f, entry); n > entrySize {
return missing(errors.New("too long"))
} else if err != io.ErrUnexpectedEOF {
if err == io.EOF {
return missing(errors.New("file is empty"))
}
return missing(err)
} else if n < entrySize {
return missing(errors.New("entry file incomplete"))
}
if entry[0] != 'v' || entry[1] != '1' || entry[2] != ' ' || entry[3+hexSize] != ' ' || entry[3+hexSize+1+hexSize] != ' ' || entry[3+hexSize+1+hexSize+1+20] != ' ' || entry[entrySize-1] != '\n' {
return missing(errors.New("invalid header"))
}
eid, entry := entry[3:3+hexSize], entry[3+hexSize:]
eout, entry := entry[1:1+hexSize], entry[1+hexSize:]
esize, entry := entry[1:1+20], entry[1+20:]
etime, entry := entry[1:1+20], entry[1+20:]
var buf [HashSize]byte
if _, err := hex.Decode(buf[:], eid); err != nil {
return missing(fmt.Errorf("decoding ID: %v", err))
} else if buf != id {
return missing(errors.New("mismatched ID"))
}
if _, err := hex.Decode(buf[:], eout); err != nil {
return missing(fmt.Errorf("decoding output ID: %v", err))
}
i := 0View on GitHub (pinned to b6b368adc5)
Solutions
- Run go clean -cache to remove truncated entries
- Check disk space on the GOCACHE partition (df -h)
- Ensure stable system conditions during builds — avoid hard kills during compilation
- Verify no external tool (backup, sync, antivirus) is modifying cache files
Example fix
// before: truncated cache entries from interrupted builds // $ go build ./... # fails with 'cache entry not found: entry file incomplete' // after: clean cache // $ go clean -cache && go build ./...
Defensive patterns
Strategy: try-catch
Validate before calling
// Verify cache integrity before a critical build by attempting
// to read and validate a known-good entry.
func verifyCacheEntry(cache cache.Cache, id cache.ActionID) bool {
_, err := cache.Get(id)
return err == nil // any error (including truncated) returns false
} Type guard
func isIncompleteEntry(err error) bool {
return err != nil && strings.Contains(err.Error(), "entry file incomplete")
} Try / catch
// Same pattern as all cache get errors:
// entry, err := cache.Get(id)
// if err != nil {
// // Truncated entry — treat as miss, rebuild
// output = rebuild()
// } Prevention
- Avoid interrupting builds with SIGKILL — use SIGINT (Ctrl+C) for graceful shutdown
- Ensure sufficient disk space to prevent partial writes
- Don't run multiple go builds writing to the same GOCACHE simultaneously on different machines via NFS
- Run go clean -cache if you suspect corruption from an interrupted build
When it happens
Trigger: DiskCache.get(id) reads the entry file and io.ReadFull returns ErrUnexpectedEOF with 0 < n < entrySize. The read started successfully but hit EOF before filling the minimum entrySize-byte buffer.
Common situations: Power loss or kill -9 during a cache write truncated the file; filesystem ran out of space partway through the write; disk sector corruption truncated the file; external tool (backup sync, antivirus) partially copied or quarantined the file.
Related errors
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/f94fc10955b6103e.
Report an issue: GitHub.