JuliusBrussee/caveman · error
cachebench: malformed Hugging Face rows array
Error message
cachebench: malformed Hugging Face rows array
What it means
Raised in readHFRows when, after consuming the rows elements, the closing token is not ']'. The rows array was never terminated (truncated input, nested bracket mismatch, or trailing junk inside the array).
Solutions
- Check the JSON with a strict validator such as jq . to locate the unbalanced bracket
- Verify the input was not cut off by the MaxInputBytes limit or a partial download
- Ensure no row object contains an unescaped ']' that broke the structure
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cacheengine/cachebench/corpus.go:284 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18).
Data as JSON: /api/errors/a55be2a65d5b906b.
Report an issue: GitHub.
Appendix: source
Thrown at cacheengine/cachebench/corpus.go:284
return nil, fmt.Errorf("cachebench: decode Hugging Face row: %w", err)
}
if len(raw) > limits.MaxRowBytes {
return nil, fmt.Errorf("cachebench: Hugging Face row exceeds %d bytes", limits.MaxRowBytes)
}
var wire hfRowWire
if err := decodeOneJSON(raw, &wire); err != nil {
return nil, fmt.Errorf("cachebench: decode Hugging Face row: %w", err)
}
row, err := validateCorpusWire(wire.Row, wire.RowIndex, limits)
if err != nil {
return nil, fmt.Errorf("cachebench: Hugging Face row %d: %w", wire.RowIndex, err)
}
if err := appendCorpusRow(&rows, sessions, &retainedBytes, row, limits); err != nil {
return nil, fmt.Errorf("cachebench: Hugging Face row %d: %w", wire.RowIndex, err)
}
}
if end, err := decoder.Token(); err != nil || end != json.Delim(']') {
return nil, errors.New("cachebench: malformed Hugging Face rows array")
}
}
if end, err := decoder.Token(); err != nil || end != json.Delim('}') {
return nil, errors.New("cachebench: malformed Hugging Face rows object")
}
var trailing any
if err := decoder.Decode(&trailing); err != io.EOF {
return nil, errors.New("cachebench: trailing JSON after Hugging Face rows object")
}
if !foundRows {
return nil, errors.New("cachebench: Hugging Face response has no rows field")
}
return rows, nil
}
func decodeOneJSON(raw []byte, destination any) error {
if !validUniqueJSONObject(raw) {
return errors.New("duplicate or invalid JSON")View on GitHub (pinned to 766dce6b13)