{"record":{"id":"daa7158af5a913d1","repo":"JuliusBrussee/caveman","slug":"cachebench-replay-gap-before-q-exceeds-limit-s","errorCode":null,"errorMessage":"cachebench: replay gap before %q exceeds limit %s","messagePattern":"cachebench: replay gap before %q exceeds limit (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/replay.go","lineNumber":409,"sourceCode":"\t\ttiming[record.TimingBasis] = true\n\t\tif limits.RequireProviderTokens && record.TokenBasis != TokenProviderCounted {\n\t\t\treturn ReplayPreflight{}, fmt.Errorf(\"cachebench: replay request %q token basis %q is not provider-counted\", record.RequestID, record.TokenBasis)\n\t\t}\n\t\ttokens[record.TokenBasis] = true\n\t\tif record.DeclaredInputTokens <= 0 || record.DeclaredInputTokens < record.PrefixTokens || record.MaxOutputTokens <= 0 || !requestBudgetMatchesBody(record) {\n\t\t\treturn ReplayPreflight{}, fmt.Errorf(\"cachebench: replay request %q has invalid billed-token budget\", record.RequestID)\n\t\t}\n\t\tinput, output := int64(record.DeclaredInputTokens), int64(record.MaxOutputTokens)\n\t\tif input > limits.MaxDeclaredBilledTokens-worstCase || output > limits.MaxDeclaredBilledTokens-worstCase-input {\n\t\t\treturn ReplayPreflight{}, fmt.Errorf(\"cachebench: replay declared billed-token ceiling exceeds limit %d\", limits.MaxDeclaredBilledTokens)\n\t\t}\n\t\tdeclaredInput += input\n\t\tdeclaredOutput += output\n\t\tworstCase += input + output\n\t\tif !previous.IsZero() {\n\t\t\tgap, err := scaledReplayGap(at.Sub(previous), timeScale)\n\t\t\tif err != nil || gap > limits.MaxGap {\n\t\t\t\treturn ReplayPreflight{}, fmt.Errorf(\"cachebench: replay gap before %q exceeds limit %s\", record.RequestID, limits.MaxGap)\n\t\t\t}\n\t\t\tif int64(gap) > math.MaxInt64-scheduled {\n\t\t\t\treturn ReplayPreflight{}, errors.New(\"cachebench: replay schedule duration overflow\")\n\t\t\t}\n\t\t\tscheduled += int64(gap)\n\t\t}\n\t\tprevious = at\n\t}\n\tbases := make([]string, 0, len(timing))\n\tfor basis := range timing {\n\t\tbases = append(bases, basis)\n\t}\n\tsort.Strings(bases)\n\ttokenBases := make([]string, 0, len(tokens))\n\tfor basis := range tokens {\n\t\ttokenBases = append(tokenBases, basis)\n\t}\n\tsort.Strings(tokenBases)","sourceCodeStart":391,"sourceCodeEnd":427,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/cacheengine/cachebench/replay.go#L391-L427","documentation":"Error \"cachebench: replay gap before %q exceeds limit %s\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at cacheengine/cachebench/replay.go:409 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reduce the replay gap before the named request below the limit."],"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-15T22:17:37.221Z"}