{"record":{"id":"9b17db1f2ac9be81","repo":"JuliusBrussee/caveman","slug":"cacheengine-unexpected-delimiter","errorCode":null,"errorMessage":"cacheengine: unexpected delimiter","messagePattern":"cacheengine: unexpected delimiter","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cacheengine/native.go","lineNumber":531,"sourceCode":"\t\tif root {\n\t\t\treturn false, errors.New(\"cacheengine: request root must be object\")\n\t\t}\n\t\tfound := false\n\t\tpath = append(path, \"*\")\n\t\tfor decoder.More() {\n\t\t\tchildFound, err := inspectUniqueJSONValue(decoder, false, depth+1, provider, path)\n\t\t\tif err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t\tfound = found || childFound\n\t\t}\n\t\tclosing, err := decoder.Token()\n\t\tif err != nil || closing != json.Delim(']') {\n\t\t\treturn false, errors.New(\"cacheengine: invalid array close\")\n\t\t}\n\t\treturn found, nil\n\tdefault:\n\t\treturn false, errors.New(\"cacheengine: unexpected delimiter\")\n\t}\n}\n","sourceCodeStart":513,"sourceCodeEnd":534,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/cacheengine/native.go#L513-L534","documentation":"Thrown by inspectUniqueJSONValue's default branch when the decoded token is a json.Delim that is neither '{' nor '[' — i.e. a leading '}' or ']'. Go's streaming decoder only returns delimiters at structurally valid positions, so this branch is a defensive unreachable guard against decoder/protocol changes, not a condition real input should produce.","triggerScenarios":"Effectively unreachable via encoding/json: a Token() call never yields a closing delimiter where an opening value is expected (that is a syntax error returned as err instead). It exists to fail loudly if decoder semantics ever change.","commonSituations":"None in practice; if observed, suspect a wrapped/patched decoder, a custom Token implementation, or a library version whose walker is out of sync with the codec.","solutions":["If you ever see it, capture the exact body and library version and report it upstream — the input itself is not fixable client-side","Ensure you pass the standard *json.Decoder contract if you wrap the engine's inspection path","Keep the engine and codec versions in lockstep (no vendored forks of encoding/json)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"// n/a","tryCatchPattern":"if err := eng.Execute(ctx, req); err != nil && strings.Contains(err.Error(), \"unexpected delimiter\") { captureBodyForReport(body); return err }","preventionTips":["Treat this error as an engine bug: report the body and version upstream","Do not vendor a modified encoding/json alongside the engine"],"tags":["cacheengine","json","defensive","unreachable","go"],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}