JuliusBrussee/caveman · error
cachebench: read corpus
Error message
cachebench: read corpus: %w
What it means
I/O wrap in readLMCacheJSONL: after the line loop, scanner.Err() reported a read failure (truncated file, I/O error, or a line over the scanner buffer) while reading the JSONL corpus. The corpus input stream is at fault.
Solutions
- If the wrapped error is bufio.ErrTooLong, raise MaxRowBytes or split oversized rows
- Check the underlying reader for I/O problems (truncated download, closed pipe)
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cacheengine/cachebench/corpus.go:222 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/245e6c9fa988b01e.
Report an issue: GitHub.
Appendix: source
Thrown at cacheengine/cachebench/corpus.go:222
for line := 1; scanner.Scan(); line++ {
raw := bytes.TrimSpace(scanner.Bytes())
if len(raw) == 0 {
continue
}
var wire lmcacheRowWire
if err := decodeOneJSON(raw, &wire); err != nil {
return nil, fmt.Errorf("cachebench: corpus line %d: %w", line, err)
}
row, err := validateCorpusWire(wire, line-1, limits)
if err != nil {
return nil, fmt.Errorf("cachebench: corpus line %d: %w", line, err)
}
if err := appendCorpusRow(&rows, sessions, &retainedBytes, row, limits); err != nil {
return nil, fmt.Errorf("cachebench: corpus line %d: %w", line, err)
}
}
if err := scanner.Err(); err != nil {
return nil, fmt.Errorf("cachebench: read corpus: %w", err)
}
return rows, nil
}
func readHFRows(reader io.Reader, limits CorpusLimits) ([]CorpusRow, error) {
decoder := json.NewDecoder(reader)
first, err := decoder.Token()
if err != nil || first != json.Delim('{') {
return nil, errors.New("cachebench: Hugging Face rows root must be object")
}
rows := make([]CorpusRow, 0)
sessions := map[string]bool{}
var retainedBytes int64
foundRows := false
rootKeys := map[string]bool{}
for decoder.More() {
keyToken, err := decoder.Token()
if err != nil {View on GitHub (pinned to 766dce6b13)