JuliusBrussee/caveman · error
cachebench: unexpected JSON delimiter
Error message
cachebench: unexpected JSON delimiter
What it means
The streaming decoder produced a json.Delim that is none of '{', '}', '[', ']' in a position expecting a structural token — effectively unreachable with encoding/json today, this guard defends the validator's switch against decoder changes and truly malformed token streams.
Solutions
- Treat the payload as corrupt and regenerate it from a trusted serializer
- Report the input as malformed if it reproduces; no valid JSON should reach this branch
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cacheengine/cachebench/strictjson.go:86 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18).
Data as JSON: /api/errors/ccce468cdc10ab4b.
Report an issue: GitHub.
Appendix: source
Thrown at cacheengine/cachebench/strictjson.go:86
return errors.New("cachebench: invalid object close")
}
return nil
case '[':
if root {
return errors.New("cachebench: JSON root must be object")
}
for decoder.More() {
if err := validateUniqueJSONValue(decoder, false, depth+1); err != nil {
return err
}
}
closing, err := decoder.Token()
if err != nil || closing != json.Delim(']') {
return errors.New("cachebench: invalid array close")
}
return nil
default:
return errors.New("cachebench: unexpected JSON delimiter")
}
}
View on GitHub (pinned to 766dce6b13)