{"record":{"id":"f7d5521d4ef7386e","repo":"JuliusBrussee/caveman","slug":"cachebench-duplicate-replay-request-q","errorCode":null,"errorMessage":"cachebench: duplicate replay request %q","messagePattern":"cachebench: duplicate replay request %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/replay.go","lineNumber":375,"sourceCode":"\t\treturn ReplayPreflight{}, errors.New(\"cachebench: replay trace is empty\")\n\t}\n\tif limits.MaxRequests <= 0 || limits.MaxDeclaredBilledTokens <= 0 || limits.MaxGap <= 0 || limits.MaxScheduleDrift <= 0 || limits.MaxConcurrency <= 0 || limits.MaxConcurrency > 1024 {\n\t\treturn ReplayPreflight{}, errors.New(\"cachebench: positive replay request, token, gap, schedule-drift, and concurrency limits required; concurrency cannot exceed 1024\")\n\t}\n\tif len(records) > limits.MaxRequests {\n\t\treturn ReplayPreflight{}, fmt.Errorf(\"cachebench: replay population %d exceeds request limit %d\", len(records), limits.MaxRequests)\n\t}\n\tif timeScale <= 0 || math.IsNaN(timeScale) || math.IsInf(timeScale, 0) || timeScale > 1000 {\n\t\treturn ReplayPreflight{}, errors.New(\"cachebench: time scale must be greater than zero and at most 1000\")\n\t}\n\tseen := make(map[string]bool, len(records))\n\ttiming := map[string]bool{}\n\ttokens := map[string]bool{}\n\tvar previous time.Time\n\tvar declaredInput, declaredOutput, worstCase, scheduled int64\n\tfor index, record := range records {\n\t\tif seen[record.RequestID] {\n\t\t\treturn ReplayPreflight{}, fmt.Errorf(\"cachebench: duplicate replay request %q\", record.RequestID)\n\t\t}\n\t\tseen[record.RequestID] = true\n\t\tif record.Schema != TraceSchema {\n\t\t\treturn ReplayPreflight{}, fmt.Errorf(\"cachebench: replay request %q needs %s billed-token metadata\", record.RequestID, TraceSchema)\n\t\t}\n\t\tif _, err := record.NativeRequest(); err != nil {\n\t\t\treturn ReplayPreflight{}, fmt.Errorf(\"cachebench: replay request %d: %w\", index, err)\n\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)","sourceCodeStart":357,"sourceCodeEnd":393,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/cachebench/replay.go#L357-L393","documentation":"During ValidateReplay's per-record loop, a request_id was seen twice in the trace. Replays require unique request IDs so per-request evidence and budgets can be joined unambiguously.","triggerScenarios":"Thrown at cacheengine/cachebench/replay.go:375 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Deduplicate the trace by request id","Regenerate the trace with unique ids per request"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"766dce6b1394ebb56a3090748d5a0240a5aefb36","analyzedAt":"2026-08-18T03:14:35.516Z","contentChangedAt":"2026-08-18T03:14:35.516Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}