JuliusBrussee/caveman · error

cachebench: trace line %d: incomplete or mismatched billed-t

Error message

cachebench: trace line %d: incomplete or mismatched billed-token budget

What it means

Error "cachebench: trace line %d: incomplete or mismatched billed-token budget" thrown in JuliusBrussee/caveman.

Source

Thrown at cacheengine/cachebench/trace.go:331

			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)
			}
		}
		if record.Schema == TraceSchema {
			if record.DeclaredInputTokens <= 0 || record.DeclaredInputTokens < record.PrefixTokens || record.MaxOutputTokens <= 0 || !requestBudgetMatchesBody(record) {
				return nil, fmt.Errorf("cachebench: trace line %d: incomplete or mismatched billed-token budget", line)
			}
		}
		seen[record.RequestID] = true
		record.Body = append(json.RawMessage(nil), record.Body...)
		records = append(records, record)
	}
	if err := scanner.Err(); err != nil {
		return nil, fmt.Errorf("cachebench: read trace: %w", err)
	}
	if len(records) == 0 {
		return nil, errors.New("cachebench: no trace records")
	}
	return records, nil
}

// NativeRequest reconstructs exact optimizer input captured by v2 or v3 trace.
// Legacy v1 traces remain readable for observation joins, but cannot drive live
// replay because they omitted routing and economics inputs.

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. Fix the billed-token budget on the trace line.

When it happens

Trigger: Thrown at cacheengine/cachebench/trace.go:331 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/b53ab24d852cc860. Report an issue: GitHub.