{"record":{"id":"61a6766b016f5d38","repo":"JuliusBrussee/caveman","slug":"cachebench-replay-gap-overflow","errorCode":null,"errorMessage":"cachebench: replay gap overflow","messagePattern":"cachebench: replay gap overflow","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/replay.go","lineNumber":789,"sourceCode":"\t\tTimingBasis: record.TimingBasis, TokenBasis: record.TokenBasis, TimeScale: scale,\n\t\tTimingFaithful: record.TimingBasis == TimingGrounded && scale == 1 && drift <= tolerance,\n\t\tScheduledAt:    scheduled.Format(time.RFC3339Nano), ScheduleDriftMilliseconds: drift.Milliseconds(),\n\t\tScheduleToleranceMilliseconds: tolerance.Milliseconds(),\n\t\tStartedAt:                     started.Format(time.RFC3339Nano), Applied: optimized.Applied,\n\t\tDecision: optimized.Decision, Reason: optimized.Reason, Attribution: optimized.Profile.Attribution,\n\t\tOptimizerIDs: append([]string(nil), optimized.OptimizerIDs...),\n\t}\n}\n\nfunc scaledReplayGap(gap time.Duration, scale float64) (time.Duration, error) {\n\tif gap < 0 || scale <= 0 || math.IsNaN(scale) || math.IsInf(scale, 0) {\n\t\treturn 0, errors.New(\"cachebench: invalid replay gap\")\n\t}\n\tif gap == 0 {\n\t\treturn 0, nil\n\t}\n\tif scale > float64(math.MaxInt64)/float64(gap) {\n\t\treturn 0, errors.New(\"cachebench: replay gap overflow\")\n\t}\n\treturn time.Duration(float64(gap) * scale), nil\n}\n\nfunc sleepContext(ctx context.Context, delay time.Duration) error {\n\tif delay <= 0 {\n\t\treturn nil\n\t}\n\ttimer := time.NewTimer(delay)\n\tdefer timer.Stop()\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase <-timer.C:\n\t\treturn nil\n\t}\n}\n","sourceCodeStart":771,"sourceCodeEnd":807,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/cacheengine/cachebench/replay.go#L771-L807","documentation":"Error \"cachebench: replay gap overflow\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at cacheengine/cachebench/replay.go:789 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce replay gaps so cumulative values do not overflow."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}