{"record":{"id":"054872c196baee56","repo":"JuliusBrussee/caveman","slug":"cachebench-observation-request-q-absent-from-tra","errorCode":null,"errorMessage":"cachebench: observation request %q absent from trace","messagePattern":"cachebench: observation request %q absent from trace","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/observed.go","lineNumber":59,"sourceCode":"\tfor index, request := range trace {\n\t\tif request.Schema != TraceSchema && request.Schema != TraceSchemaV2 || strings.TrimSpace(request.RequestID) == \"\" {\n\t\t\treturn Report{}, fmt.Errorf(\"cachebench: trace request %d has invalid schema or request_id\", index)\n\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","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/cacheengine/cachebench/observed.go#L41-L77","documentation":"An observation record references a RequestID that does not exist in the supplied trace, so the exact join cannot be completed. The evaluator looks each record up in the by-ID map built from the trace and fails on the first miss, quoting the orphan ID.","triggerScenarios":"EvaluateObservedAgainstTrace where records contain a RequestID absent from every trace entry — e.g. observations from a different (longer or newer) run than the trace.","commonSituations":"Observations appended after the trace was regenerated; mixed epochs in one directory; request IDs altered by a proxy between replay and observation capture.","solutions":["Pair the observation file with the trace file from the identical replay run.","Filter observations down to IDs present in the trace before calling (after also fixing the population count).","Ensure any ID-rewriting middleware is disabled so IDs pass through unchanged."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"func joinableToTrace(records []ObservationRecord, trace []TraceRecord) error {\n\tbyID := map[string]bool{}\n\tfor _, t := range trace {\n\t\tbyID[t.RequestID] = true\n\t}\n\tfor _, r := range records {\n\t\tif !byID[r.RequestID] {\n\t\t\treturn fmt.Errorf(\"observation %q absent from trace\", r.RequestID)\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Bind observation and trace files to the same run ID at creation.","Disable middleware that rewrites request IDs during capture.","Diff request-ID sets between files before evaluation."],"tags":["go","cachebench","join","data-integrity"],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}