{"record":{"id":"aa29fd7c08f43674","repo":"JuliusBrussee/caveman","slug":"cachebench-replay-declared-billed-token-ceiling-e","errorCode":null,"errorMessage":"cachebench: replay declared billed-token ceiling exceeds limit %d","messagePattern":"cachebench: replay declared billed-token ceiling exceeds limit (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/replay.go","lineNumber":401,"sourceCode":"\t\t}\n\t\tat, err := time.Parse(time.RFC3339Nano, record.At)\n\t\tif err != nil || !previous.IsZero() && at.Before(previous) {\n\t\t\treturn ReplayPreflight{}, fmt.Errorf(\"cachebench: replay request %q has invalid time order\", record.RequestID)\n\t\t}\n\t\tif limits.RequireGroundedTiming && record.TimingBasis != TimingGrounded {\n\t\t\treturn ReplayPreflight{}, fmt.Errorf(\"cachebench: replay request %q timing basis %q is not globally grounded\", record.RequestID, record.TimingBasis)\n\t\t}\n\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 {","sourceCodeStart":383,"sourceCodeEnd":419,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/cacheengine/cachebench/replay.go#L383-L419","documentation":"Error \"cachebench: replay declared billed-token ceiling exceeds limit %d\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at cacheengine/cachebench/replay.go:401 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Lower the declared billed-token ceiling 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-15T17:31:12.345Z"}