{"record":{"id":"f5fba2abde4f6b21","repo":"JuliusBrussee/caveman","slug":"cachebench-observation-request-q-provider-epoch","errorCode":null,"errorMessage":"cachebench: observation request %q provider/epoch mismatch","messagePattern":"cachebench: observation request %q provider/epoch mismatch","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/observed.go","lineNumber":62,"sourceCode":"\t\t}\n\t\tif _, exists := byID[request.RequestID]; exists {\n\t\t\treturn Report{}, fmt.Errorf(\"cachebench: duplicate trace request %q\", request.RequestID)\n\t\t}\n\t\tif strings.TrimSpace(request.Provider) == \"\" || strings.TrimSpace(request.Epoch) == \"\" || !validUniqueJSONObject(request.Body) || request.BodySHA256 == \"\" || request.BodySHA256 != bodyDigest(request.Body) {\n\t\t\treturn Report{}, fmt.Errorf(\"cachebench: trace request %q has invalid identity, body, or digest\", request.RequestID)\n\t\t}\n\t\tif request.StableSegmentCount < 0 || request.StableSegmentCount > len(request.Prefix) || !validPrefix(request.Prefix) {\n\t\t\treturn Report{}, fmt.Errorf(\"cachebench: trace request %q has invalid prefix\", request.RequestID)\n\t\t}\n\t\tbyID[request.RequestID] = request\n\t}\n\tfor _, record := range records {\n\t\trequest, exists := byID[record.RequestID]\n\t\tif !exists {\n\t\t\treturn Report{}, fmt.Errorf(\"cachebench: observation request %q absent from trace\", record.RequestID)\n\t\t}\n\t\tif record.Provider != request.Provider || record.Epoch != request.Epoch {\n\t\t\treturn Report{}, fmt.Errorf(\"cachebench: observation request %q provider/epoch mismatch\", record.RequestID)\n\t\t}\n\t\tif record.RequestBodySHA256 == \"\" || record.RequestBodySHA256 != request.BodySHA256 {\n\t\t\treturn Report{}, fmt.Errorf(\"cachebench: observation request %q body digest mismatch\", record.RequestID)\n\t\t}\n\t}\n\treport, err := EvaluateObserved(records, target)\n\tif err != nil {\n\t\treturn Report{}, err\n\t}\n\treport.EvidenceLimitations = append([]string{\n\t\t\"observation population exactly joined to supplied request trace by request ID and body SHA-256\",\n\t}, report.EvidenceLimitations...)\n\treturn report, nil\n}\n\n// ObservationReadLimits bounds JSONL evidence decoding.\ntype ObservationReadLimits struct {\n\tMaxLineBytes int","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/cacheengine/cachebench/observed.go#L44-L80","documentation":"An observation record joined by RequestID carries a Provider or Epoch that differs from the trace record's values. Provider and epoch are part of the observation's identity, so a mismatch means the observation was taken in a different context than the traced request.","triggerScenarios":"EvaluateObservedAgainstTrace joining record to trace where record.Provider != request.Provider or record.Epoch != request.Epoch — commonly observations captured in one epoch being evaluated against a trace from another.","commonSituations":"Re-running only the observation phase under a new epoch label while reusing an old trace; provider string differing in case or alias between capture and trace generation.","solutions":["Regenerate both trace and observations within the same epoch.","Make provider strings identical (same casing/alias) in both pipelines.","If epochs were renamed intentionally, regenerate the trace under the new epoch label."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"func sameContext(records []ObservationRecord, trace []TraceRecord) error {\n\tbyID := map[string]TraceRecord{}\n\tfor _, t := range trace {\n\t\tbyID[t.RequestID] = t\n\t}\n\tfor _, r := range records {\n\t\tif t, ok := byID[r.RequestID]; ok && (r.Provider != t.Provider || r.Epoch != t.Epoch) {\n\t\t\treturn fmt.Errorf(\"observation %q provider/epoch mismatch\", r.RequestID)\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Stamp provider and epoch identically in both pipelines from shared config.","Never reuse an old trace against fresh observations from a new epoch.","Normalize provider aliases to canonical strings at config load."],"tags":["go","cachebench","epoch","provider","data-integrity"],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}