{"record":{"id":"ff9979b38cd7876e","repo":"JuliusBrussee/caveman","slug":"cachebench-replay-observation-is-not-bound-to-rep","errorCode":null,"errorMessage":"cachebench: replay observation is not bound to replay evidence","messagePattern":"cachebench: replay observation is not bound to replay evidence","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/replay.go","lineNumber":838,"sourceCode":"\t\treturn err\n\t}\n\treturn emit(result)\n}\n\nfunc validateReplayResult(result ReplayResult) error {\n\tif err := validateReplayEvidence(result.Evidence); err != nil {\n\t\treturn err\n\t}\n\tif result.Evidence.Success {\n\t\tif result.Observation == nil || len(result.ProviderResponse) == 0 || len(result.VerificationEvidence) == 0 || bodyDigest(result.ProviderResponse) != result.Evidence.ProviderEvidenceSHA256 || bodyDigest(result.VerificationEvidence) != result.Evidence.QualityEvidenceSHA256 {\n\t\t\treturn errors.New(\"cachebench: successful replay result is not bound to retained artifacts\")\n\t\t}\n\t\tif err := validateObservationRecords([]ObservationRecord{*result.Observation}); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tobservation := result.Observation\n\t\tif observation.RequestID != result.Evidence.RequestID || observation.Provider != result.Evidence.Provider || observation.Epoch != result.Evidence.Epoch || observation.RequestBodySHA256 != result.Evidence.TraceBodySHA256 || observation.ProviderEvidenceSHA256 != result.Evidence.ProviderEvidenceSHA256 || observation.EligibleInputTokens != result.Evidence.ProviderTotalInputTokens || observation.Applied != result.Evidence.Applied || observation.EngineDecision != result.Evidence.Decision || observation.EngineReason != result.Evidence.Reason || observation.Attribution != result.Evidence.Attribution || !slices.Equal(observation.OptimizerIDs, result.Evidence.OptimizerIDs) || observation.QualityPassed != result.Evidence.QualityPassed || observation.QualityEvidenceSHA256 != result.Evidence.QualityEvidenceSHA256 || observation.QualityVerifier != result.Evidence.QualityVerifier || bodyDigest(observation.Usage) != result.Evidence.ProviderUsageSHA256 {\n\t\t\treturn errors.New(\"cachebench: replay observation is not bound to replay evidence\")\n\t\t}\n\t\treturn nil\n\t}\n\tif result.Observation != nil || len(result.VerificationEvidence) != 0 {\n\t\treturn errors.New(\"cachebench: failed replay result contains success-only artifacts\")\n\t}\n\tif len(result.ProviderResponse) > 0 {\n\t\tif bodyDigest(result.ProviderResponse) != result.Evidence.ProviderEvidenceSHA256 {\n\t\t\treturn errors.New(\"cachebench: failed replay response is not bound to evidence\")\n\t\t}\n\t} else if result.Evidence.ProviderEvidenceSHA256 != \"\" {\n\t\treturn errors.New(\"cachebench: failed replay evidence references missing response\")\n\t}\n\treturn nil\n}\n\nfunc validTaskVerification(verification TaskVerification) bool {\n\treturn validBoundedText(verification.Verifier, 256, false) && validUniqueJSONObject(verification.Evidence)","sourceCodeStart":820,"sourceCodeEnd":856,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/cachebench/replay.go#L820-L856","documentation":"Raised by validateReplayResult for a successful replay: the bound ObservationRecord fails the cross-check against the evidence record — request_id, provider, epoch, request body digest (vs TraceBodySHA256), provider evidence digest, eligible input tokens, or applied flag disagree. The observation must be the exact counterpart of the evidence, preventing evidence/observation mismatches.","triggerScenarios":"Thrown at cacheengine/cachebench/replay.go:838 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Regenerate the observation from the same replay attempt as the evidence","Check that digest fields are copied from the same raw bytes on both records","Never mix observations from one run with evidence from another"],"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"}