VALIDATION_ERROR — Request body is malformed
Summary
Section titled “Summary”The request was rejected at validation. The message always names the specific field and what’s wrong with it.
HTTP status
Section titled “HTTP status”422 Unprocessable Entity. Standard envelope.
Example response
Section titled “Example response”{ "success": false, "error": { "code": "VALIDATION_ERROR", "message": "Field 'responses' must be a non-empty array of strings.", "request_id": "req_01HXJZK4ABCDEF", "doc_url": "https://docs.surveycoder.io/errors/validation-error" }}Why this happens
Section titled “Why this happens”- A required field is missing (
question,responses). - A field has the wrong type (e.g.
responses: "Tide..."instead of an array). - A string is over the size limit (most fields cap at 2,000 characters per verbatim).
- An
Idempotency-Keywas reused with a different body. - A JSON parse error before our validator even ran (malformed JSON returns
VALIDATION_ERRORwithmessage: "Invalid JSON").
How to fix it
Section titled “How to fix it”- Read the
message— it’s specific. If it saysresponses must be a non-empty array, that’s the literal fix. - Validate against the API reference request shape for the endpoint you called.
- Watch for accidental
nullvalues inside arrays —["a", null, "b"]fails validation. - If you got this on an idempotency retry, you’re reusing a key with a changed body. Use a fresh UUID.
Related
Section titled “Related”- API reference
- Idempotency
NOT_FOUND— when a referenced ID doesn’t exist