Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

14221: Enqueue: Provided Attributes JSON was not valid


ERROR: 14221

error-14221 page anchor
ERROR

You receive this error when <Enqueue> includes a <Task> noun whose body is not a valid JSON object. When you use workflowSid with <Enqueue>, Twilio creates a new TaskRouter Task for the call, and the <Task> noun sets the attributes for that Task.

Possible causes

possible-causes page anchor
  • The <Task> noun body contains JSON that Twilio cannot parse as a valid object.
  • Your application generated malformed task attributes before returning the TwiML response for <Enqueue>. Twilio expects those attributes to be formatted as JSON.
  • Custom task attributes were added to a TaskRouter enqueue flow, but the value sent in <Task> was not valid JSON.
  • Update the <Task> noun body so it contains a valid JSON object before Twilio executes the <Enqueue> verb.
  • If you generate TwiML in code, build the attributes as an object and serialize them with JSON.stringify instead of hand-writing the JSON string.
  • If you do not need custom task attributes, omit <Task>. Twilio will still create the Task with the call's standard parameters as attributes when you enqueue with workflowSid.

Additional resources

additional-resources page anchor