JuliusBrussee/caveman · error
cachebench: empty corpus
Error message
cachebench: empty corpus
What it means
Raised in ReadAgentCorpus after the selected reader (readLMCacheJSONL or readHFRows) returned successfully but produced zero rows. The input parsed cleanly yet contained no usable corpus rows, so downstream benchmarking would have nothing to replay.
Solutions
- Verify the input file actually contains data lines/rows and is not empty or whitespace-only
- Confirm the format argument matches the file's actual layout (JSONL vs HF rows object)
- Check that limits (MaxRows, MaxInputBytes) are not filtering out every row before parsing completes
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cacheengine/cachebench/corpus.go:164 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18).
Data as JSON: /api/errors/6a5e9da66b80dfcb.
Report an issue: GitHub.
Appendix: source
Thrown at cacheengine/cachebench/corpus.go:164
}
limited := &io.LimitedReader{R: reader, N: limits.MaxInputBytes + 1}
var rows []CorpusRow
switch format {
case CorpusFormatLMCacheJSONL:
rows, err = readLMCacheJSONL(limited, limits)
case CorpusFormatHFRows:
rows, err = readHFRows(limited, limits)
default:
return AgentCorpus{}, fmt.Errorf("cachebench: unsupported corpus format %q", format)
}
if limited.N <= 0 {
return AgentCorpus{}, fmt.Errorf("cachebench: corpus input exceeds byte limit %d", limits.MaxInputBytes)
}
if err != nil {
return AgentCorpus{}, err
}
if len(rows) == 0 {
return AgentCorpus{}, errors.New("cachebench: empty corpus")
}
return AgentCorpus{Metadata: metadata, Rows: rows, SHA256: corpusDigest(rows), Bytes: corpusRetainedBytes(rows)}, nil
}
func normalizedCorpusLimits(limits CorpusLimits) (CorpusLimits, error) {
defaults := DefaultCorpusLimits()
if limits.MaxRows <= 0 {
limits.MaxRows = defaults.MaxRows
}
if limits.MaxSessions <= 0 {
limits.MaxSessions = defaults.MaxSessions
}
if limits.MaxMessagesPerRequest <= 0 {
limits.MaxMessagesPerRequest = defaults.MaxMessagesPerRequest
}
if limits.MaxRowBytes <= 0 {
limits.MaxRowBytes = defaults.MaxRowBytes
}View on GitHub (pinned to 766dce6b13)