OriginChainDB
Errors

400 - malformed JSON body

← Errors examples

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.

Fix the JSON before sending it againThe request cannot reach its handler until the body parses.
  1. Locate invalid JSONCheck commas, quotes and the reported parse location.
  2. Encode the bodyUse a JSON encoder and the correct content type.
  3. 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

  1. Build the body with a JSON encoder.
  2. Check that the body and Content-Type agree.
  3. 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-Type header (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.

© 2026 Silicoyn Technologies Pvt Ltd

On this page