{"record":{"id":"2357278fe23517f0","repo":"JuliusBrussee/caveman","slug":"cachebench-invalid-object-close","errorCode":null,"errorMessage":"cachebench: invalid object close","messagePattern":"cachebench: invalid object close","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cacheengine/cachebench/strictjson.go","lineNumber":68,"sourceCode":"\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\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 array close\")\n\t\t}\n\t\treturn nil\n\tdefault:\n\t\treturn errors.New(\"cachebench: unexpected JSON delimiter\")","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/766dce6b1394ebb56a3090748d5a0240a5aefb36/cacheengine/cachebench/strictjson.go#L50-L86","documentation":"After an object's members were consumed, the next decoder token was missing or not the '}' delimiter — the object is unterminated or malformed. This is a structural corruption guard in the strict unique-key JSON validator.","triggerScenarios":"Thrown at cacheengine/cachebench/strictjson.go:68 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the truncated or malformed JSON so every object is closed with '}'","Re-serialize the body from parsed data instead of hand-editing the raw bytes"],"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"}