{"record":{"id":"1a88345a345a568d","repo":"JuliusBrussee/caveman","slug":"cachebench-observation-d-has-invalid-optimizer-i","errorCode":null,"errorMessage":"cachebench: observation %d has invalid optimizer identity","messagePattern":"cachebench: observation (.+?) has invalid optimizer identity","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/observed.go","lineNumber":212,"sourceCode":"\tseen := make(map[string]bool, len(records))\n\tfor index, record := range records {\n\t\tif record.Schema != ObservationSchema && record.Schema != ObservationSchemaV2 {\n\t\t\treturn fmt.Errorf(\"cachebench: observation %d schema %q\", index, record.Schema)\n\t\t}\n\t\tif !validBoundedText(record.RequestID, 512, false) || seen[record.RequestID] {\n\t\t\treturn fmt.Errorf(\"cachebench: observation %d empty or duplicate request_id\", index)\n\t\t}\n\t\tseen[record.RequestID] = true\n\t\tif !validBoundedText(record.Provider, 64, false) || !validBoundedText(record.Epoch, 1024, false) || !validBoundedText(record.QualityVerifier, 256, false) || !validBoundedText(record.ProfileID, 256, true) || !validBoundedText(record.EngineReason, 1024, true) || !validEvidenceSHA256(record.ProviderEvidenceSHA256) || !validEvidenceSHA256(record.QualityEvidenceSHA256) {\n\t\t\treturn fmt.Errorf(\"cachebench: observation %d missing provider or quality evidence provenance\", index)\n\t\t}\n\t\tif record.RequestBodySHA256 != \"\" && !validSHA256(record.RequestBodySHA256) {\n\t\t\treturn fmt.Errorf(\"cachebench: observation %d has invalid request body digest\", index)\n\t\t}\n\t\toptimizerIDs := map[string]bool{}\n\t\tfor _, optimizerID := range record.OptimizerIDs {\n\t\t\tif !validBoundedText(optimizerID, 256, false) || optimizerIDs[optimizerID] {\n\t\t\t\treturn fmt.Errorf(\"cachebench: observation %d has invalid optimizer identity\", index)\n\t\t\t}\n\t\t\toptimizerIDs[optimizerID] = true\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc validSHA256(value string) bool {\n\treturn len(value) == 64 && strings.Trim(value, \"0123456789abcdef\") == \"\"\n}\n\nfunc validEvidenceSHA256(value string) bool {\n\treturn validSHA256(value) && value != bodyDigest(nil)\n}\n\nfunc evaluateObservedProvider(provider string, records []ObservationRecord, target Target) ProviderReport {\n\treport := ProviderReport{Provider: provider, Model: \"observed\", Rolling: true, EvaluatedRequests: len(records)}\n\tqualityPasses := 0","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/cachebench/observed.go#L194-L230","documentation":"validateObservationRecords found invalid optimizer attribution: profile id/attribution text or optimizer id entries failed the bounded-text checks. These fields tie cache savings to specific optimizers and must be well-formed.","triggerScenarios":"Thrown at cacheengine/cachebench/observed.go:212 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the engine result's profile and optimizer ids are propagated unmodified","Sanitize optimizer identifiers at capture time"],"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"}