{"record":{"id":"2debbea795538896","repo":"JuliusBrussee/caveman","slug":"cachebench-invalid-replay-attribution","errorCode":null,"errorMessage":"cachebench: invalid replay attribution","messagePattern":"cachebench: invalid replay attribution","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/replay.go","lineNumber":889,"sourceCode":"\t\treturn errors.New(\"cachebench: invalid replay timing evidence\")\n\t}\n\tif record.LatencyMilliseconds < 0 {\n\t\treturn errors.New(\"cachebench: negative replay latency\")\n\t}\n\tif record.ProviderUsageSHA256 != \"\" {\n\t\tif !validEvidenceSHA256(record.ProviderUsageSHA256) || !validEvidenceSHA256(record.ProviderEvidenceSHA256) || record.ProviderTotalInputTokens <= 0 || record.ProviderOutputTokens < 0 {\n\t\t\treturn errors.New(\"cachebench: invalid replay provider usage evidence\")\n\t\t}\n\t} else if record.ProviderTotalInputTokens != 0 || record.ProviderOutputTokens != 0 {\n\t\treturn errors.New(\"cachebench: replay token counters lack provider usage evidence\")\n\t}\n\tif record.Applied != (record.Decision == cacheengine.DecisionApply) || record.Applied && len(record.OptimizerIDs) == 0 {\n\t\treturn errors.New(\"cachebench: inconsistent replay engine decision\")\n\t}\n\tswitch record.Attribution {\n\tcase cacheengine.AttributionNone, cacheengine.AttributionCausal, cacheengine.AttributionAffinity, cacheengine.AttributionOrganic:\n\tdefault:\n\t\treturn errors.New(\"cachebench: invalid replay attribution\")\n\t}\n\tif record.Success {\n\t\tif record.HTTPStatus < 200 || record.HTTPStatus >= 300 || !validEvidenceSHA256(record.ProviderEvidenceSHA256) || !validEvidenceSHA256(record.ProviderUsageSHA256) || record.ProviderTotalInputTokens <= 0 || !validBoundedText(record.QualityVerifier, 256, false) || !validEvidenceSHA256(record.QualityEvidenceSHA256) || record.FailureCode != \"\" {\n\t\t\treturn errors.New(\"cachebench: incomplete successful replay evidence\")\n\t\t}\n\t} else if !validReplayFailureCode(record.FailureCode) {\n\t\treturn errors.New(\"cachebench: failed replay evidence needs known failure_code\")\n\t}\n\treturn nil\n}\n\nfunc validReplayFailureCode(value string) bool {\n\tswitch value {\n\tcase \"schedule_drift\", \"model_visible_mismatch\", \"engine_not_cacheable\", \"clock_regression\", \"transport_error\", \"provider_response_invalid\", \"provider_http_status\", \"provider_usage_invalid\", \"provider_input_budget_exceeded\", \"provider_output_budget_exceeded\", \"quality_verifier_error\", \"quality_provenance_missing\":\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}","sourceCodeStart":871,"sourceCodeEnd":907,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/cacheengine/cachebench/replay.go#L871-L907","documentation":"Error \"cachebench: invalid replay attribution\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at cacheengine/cachebench/replay.go:889 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the replay attribution fields to valid values."],"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"}