JuliusBrussee/caveman · error
cachebench: replay preparation interrupted
Error message
cachebench: replay preparation interrupted: %w
What it means
ReplayRunner.prepare aborted because the context was cancelled or its deadline expired while preparing records (running engine eligibility). The wrapped context error indicates external interruption, not a data problem.
Solutions
- Extend the run deadline for large traces
- Avoid cancelling the replay context mid-preparation
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at cacheengine/cachebench/replay.go:505 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/706f203d89785676.
Report an issue: GitHub.
Appendix: source
Thrown at cacheengine/cachebench/replay.go:505
}
anchorTrace, _ := time.Parse(time.RFC3339Nano, records[0].At)
anchorReal := now().UTC()
if runner.Limits.MaxConcurrency == 1 {
return runner.runSequential(ctx, prepared, anchorTrace, anchorReal, now, sleep, emit)
}
return runner.runConcurrent(ctx, prepared, anchorTrace, anchorReal, now, sleep, emit)
}
type preparedReplay struct {
record TraceRecord
optimized cacheengine.NativeResult
}
func (runner ReplayRunner) prepare(ctx context.Context, records []TraceRecord) ([]preparedReplay, error) {
prepared := make([]preparedReplay, 0, len(records))
for _, record := range records {
if err := ctx.Err(); err != nil {
return nil, fmt.Errorf("cachebench: replay preparation interrupted: %w", err)
}
native, err := record.NativeRequest()
if err != nil {
return nil, err
}
optimized, err := runner.Engine.Optimize(ctx, native)
if err != nil {
return nil, fmt.Errorf("cachebench: optimize request %q: %w", record.RequestID, err)
}
equivalent := bytes.Equal(native.Body, optimized.Body)
if optimized.Applied {
equivalent = ModelVisibleEquivalent(native.Body, optimized.Body)
}
if !equivalent {
return nil, &ReplayRunError{
RequestID: record.RequestID, FailureCode: "model_visible_mismatch",
Err: fmt.Errorf("cachebench: request %q failed model-visible equivalence", record.RequestID),
}View on GitHub (pinned to 766dce6b13)