Errors
400 - malformed JSON body
What happened
The body cannot be parsed as JSON, so the query has not reached its handler. Common causes include trailing commas and broken quoting.
- Locate invalid JSONCheck commas, quotes and the reported parse location.
- Encode the bodyUse a JSON encoder and the correct content type.
- Send the corrected requestVerify the response without exposing secrets in public validators.
Request that triggers it
A trailing comma after the last key in the JSON body. The closing } arrives where the parser expected another key.
curl -X POST "https://$OC_HOST/v1/tenants/$OC_TENANT/sql" \
-H "Authorization: Bearer $OC_TOKEN" \
-H "Content-Type: application/json" \
-d '{"sql": "SELECT id FROM shop.products LIMIT 1",}'Read the response
{
"error": "invalid_json",
"message": "trailing comma at byte offset 18",
"retry": false
}Fix the request
- Build the body with a JSON encoder.
- Check that the body and Content-Type agree.
- Correct the syntax and send again.
Keep in mind: Repeating the same malformed body cannot fix it. Do not paste secrets into a public JSON validator.
Common causes
- Trailing comma after the last field (JSON5 habit leaking into strict JSON).
- Unterminated string - a missing closing
"from shell-escape collisions. - Wrong
Content-Typeheader (e.g.text/plain); the router treats those as invalid JSON. - Empty body on an endpoint that requires one - the parser sees EOF where it expected
{. - String-templated payloads with unescaped quotes from user input.
Continue
See error handling and retries, or return to error examples.