JuliusBrussee/caveman · warning
cacheengine: unexpected delimiter
Error message
cacheengine: unexpected delimiter
What it means
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.
Source
Thrown at cacheengine/native.go:531
if root {
return false, errors.New("cacheengine: request root must be object")
}
found := false
path = append(path, "*")
for decoder.More() {
childFound, err := inspectUniqueJSONValue(decoder, false, depth+1, provider, path)
if err != nil {
return false, err
}
found = found || childFound
}
closing, err := decoder.Token()
if err != nil || closing != json.Delim(']') {
return false, errors.New("cacheengine: invalid array close")
}
return found, nil
default:
return false, errors.New("cacheengine: unexpected delimiter")
}
}
View on GitHub (pinned to 27d5a3981a)
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)
Defensive patterns
Strategy: try-catch
Type guard
// n/a
Try / catch
if err := eng.Execute(ctx, req); err != nil && strings.Contains(err.Error(), "unexpected delimiter") { captureBodyForReport(body); return err } Prevention
- Treat this error as an engine bug: report the body and version upstream
- Do not vendor a modified encoding/json alongside the engine
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- cacheengine: segment exceeds framing limit
- cacheengine: JSON nesting limit exceeded
- cacheengine: request root must be object
- cacheengine: duplicate or invalid object key
- cacheengine: invalid object close
AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15).
Data as JSON: /api/errors/9b17db1f2ac9be81.
Report an issue: GitHub.