JuliusBrussee/caveman · error

cachebench: corpus line

Error message

cachebench: corpus line %d: %w

What it means

A single JSONL line in the LM Cache corpus could not be processed; the wrapped error indicates whether JSON decoding, row validation, or append limits failed. The line number locates the offending record in the input stream.

Solutions

  1. Inspect the wrapped error and the cited line in the corpus file
  2. Fix or drop the malformed row and regenerate the corpus
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cacheengine/cachebench/corpus.go:211 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/dcfb0e4465485e18. Report an issue: GitHub.

Appendix: source

Thrown at cacheengine/cachebench/corpus.go:211

		return CorpusLimits{}, errors.New("cachebench: corpus limits exceed hard resource ceilings")
	}
	return limits, nil
}

func readLMCacheJSONL(reader io.Reader, limits CorpusLimits) ([]CorpusRow, error) {
	scanner := bufio.NewScanner(reader)
	scanner.Buffer(make([]byte, 64*1024), limits.MaxRowBytes)
	rows := make([]CorpusRow, 0)
	sessions := map[string]bool{}
	var retainedBytes int64
	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()

View on GitHub (pinned to 766dce6b13)