{"record":{"id":"4503aec7067346ff","repo":"JuliusBrussee/caveman","slug":"cachebench-duplicate-or-invalid-object-key","errorCode":null,"errorMessage":"cachebench: duplicate or invalid object key","messagePattern":"cachebench: duplicate or invalid object key","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/strictjson.go","lineNumber":59,"sourceCode":"\t}\n\tdelimiter, composite := token.(json.Delim)\n\tif !composite {\n\t\tif root {\n\t\t\treturn errors.New(\"cachebench: JSON root must be object\")\n\t\t}\n\t\treturn nil\n\t}\n\tswitch delimiter {\n\tcase '{':\n\t\tseen := map[string]bool{}\n\t\tfor decoder.More() {\n\t\t\tkeyToken, err := decoder.Token()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tkey, ok := keyToken.(string)\n\t\t\tif !ok || seen[key] {\n\t\t\t\treturn errors.New(\"cachebench: duplicate or invalid object key\")\n\t\t\t}\n\t\t\tseen[key] = true\n\t\t\tif err := validateUniqueJSONValue(decoder, false, depth+1); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tclosing, err := decoder.Token()\n\t\tif err != nil || closing != json.Delim('}') {\n\t\t\treturn errors.New(\"cachebench: invalid object close\")\n\t\t}\n\t\treturn nil\n\tcase '[':\n\t\tif root {\n\t\t\treturn errors.New(\"cachebench: JSON root must be object\")\n\t\t}\n\t\tfor decoder.More() {\n\t\t\tif err := validateUniqueJSONValue(decoder, false, depth+1); err != nil {\n\t\t\t\treturn err","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/cachebench/strictjson.go#L41-L77","documentation":"While walking a JSON object, the next key token was either not a string or a key already seen in this object. Strict mode rejects duplicate keys because provider cache equivalence depends on deterministic serialization, and a non-string key indicates malformed framing.","triggerScenarios":"Thrown at cacheengine/cachebench/strictjson.go:59 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove duplicate keys from the object, keeping one occurrence","Serialize with an encoder (map or struct marshaling) that cannot emit duplicate keys"],"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"}