JuliusBrussee/caveman · error
cachebench: replay schedule duration overflow
Error message
cachebench: replay schedule duration overflow
What it means
Raised in ValidateReplay when computing the total replay schedule: summing per-request timing (gaps scaled by timeScale, request durations) overflows the time.Duration/int64 range. A trace with extreme PreGap values or timestamps can produce a schedule beyond ~292 years.
Solutions
- Clamp or drop rows with absurd gap/PreGap values before building the trace
- Reduce timeScale to compress an otherwise long schedule
- Split the trace into multiple replay runs with bounded horizons
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cacheengine/cachebench/replay.go:412 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/cba2fcd6e12eeaef.
Report an issue: GitHub.
Appendix: source
Thrown at cacheengine/cachebench/replay.go:412
}
tokens[record.TokenBasis] = true
if record.DeclaredInputTokens <= 0 || record.DeclaredInputTokens < record.PrefixTokens || record.MaxOutputTokens <= 0 || !requestBudgetMatchesBody(record) {
return ReplayPreflight{}, fmt.Errorf("cachebench: replay request %q has invalid billed-token budget", record.RequestID)
}
input, output := int64(record.DeclaredInputTokens), int64(record.MaxOutputTokens)
if input > limits.MaxDeclaredBilledTokens-worstCase || output > limits.MaxDeclaredBilledTokens-worstCase-input {
return ReplayPreflight{}, fmt.Errorf("cachebench: replay declared billed-token ceiling exceeds limit %d", limits.MaxDeclaredBilledTokens)
}
declaredInput += input
declaredOutput += output
worstCase += input + output
if !previous.IsZero() {
gap, err := scaledReplayGap(at.Sub(previous), timeScale)
if err != nil || gap > limits.MaxGap {
return ReplayPreflight{}, fmt.Errorf("cachebench: replay gap before %q exceeds limit %s", record.RequestID, limits.MaxGap)
}
if int64(gap) > math.MaxInt64-scheduled {
return ReplayPreflight{}, errors.New("cachebench: replay schedule duration overflow")
}
scheduled += int64(gap)
}
previous = at
}
bases := make([]string, 0, len(timing))
for basis := range timing {
bases = append(bases, basis)
}
sort.Strings(bases)
tokenBases := make([]string, 0, len(tokens))
for basis := range tokens {
tokenBases = append(tokenBases, basis)
}
sort.Strings(tokenBases)
return ReplayPreflight{
Requests: len(records), DeclaredInputTokens: declaredInput,
DeclaredMaxOutputTokens: declaredOutput, DeclaredBilledTokens: worstCase,View on GitHub (pinned to 766dce6b13)