JuliusBrussee/caveman · error
cachebench: trace line %d: trailing JSON
Error message
cachebench: trace line %d: trailing JSON
What it means
Error "cachebench: trace line %d: trailing JSON" thrown in JuliusBrussee/caveman.
Source
Thrown at cacheengine/cachebench/trace.go:310
raw := bytes.TrimSpace(scanner.Bytes())
if len(raw) == 0 {
continue
}
if len(records) >= limits.MaxRecords {
return nil, fmt.Errorf("cachebench: trace exceeds record limit %d", limits.MaxRecords)
}
if !validUniqueJSONObject(raw) {
return nil, fmt.Errorf("cachebench: trace line %d: duplicate or invalid JSON", line)
}
decoder := json.NewDecoder(bytes.NewReader(raw))
decoder.DisallowUnknownFields()
var record TraceRecord
if err := decoder.Decode(&record); err != nil {
return nil, fmt.Errorf("cachebench: trace line %d: %w", line, err)
}
var trailing any
if err := decoder.Decode(&trailing); err != io.EOF {
return nil, fmt.Errorf("cachebench: trace line %d: trailing JSON", line)
}
if record.Schema != TraceSchema && record.Schema != TraceSchemaV2 && record.Schema != TraceSchemaV1 || !validBoundedText(record.RequestID, 512, false) || seen[record.RequestID] {
return nil, fmt.Errorf("cachebench: trace line %d: invalid schema or request_id", line)
}
if _, err := time.Parse(time.RFC3339Nano, record.At); err != nil || !validTraceIdentity(record) || record.PrefixTokens < 0 {
return nil, fmt.Errorf("cachebench: trace line %d: incomplete request identity", line)
}
if len(record.Body) > limits.MaxBodyBytes || !json.Valid(record.Body) || record.BodySHA256 == "" || record.BodySHA256 != bodyDigest(record.Body) {
return nil, fmt.Errorf("cachebench: trace line %d: invalid body or digest", line)
}
if record.StableSegmentCount < 0 || record.StableSegmentCount > len(record.Prefix) || !validPrefix(record.Prefix) {
return nil, fmt.Errorf("cachebench: trace line %d: invalid prefix", line)
}
if record.Schema == TraceSchema || record.Schema == TraceSchemaV2 {
if record.ExpectedRPM <= 0 || record.ExpectedCalls <= 0 || !validTimingBasis(record.TimingBasis) {
return nil, fmt.Errorf("cachebench: trace line %d: incomplete replay metadata", line)
}
}View on GitHub (pinned to 27d5a3981a)
Solutions
- Remove trailing JSON on the trace line.
When it happens
Trigger: Thrown at cacheengine/cachebench/trace.go:310 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15).
Data as JSON: /api/errors/521f1052adfc9ed0.
Report an issue: GitHub.