---
"@context": https://schema.org
"@type": TechArticle
"@id": https://www.twilio.com/docs/api/errors/14221#article
headline: "14221: Enqueue: Provided Attributes JSON was not valid"
url: https://www.twilio.com/docs/api/errors/14221
inLanguage: en
dateModified: 2026-06-09T11:00:42.000Z
author:
  "@type": Organization
  name: Twilio Developer Education Team
publisher:
  "@type": Organization
  name: Twilio
---

# 14221: Enqueue: Provided Attributes JSON was not valid

Log Level: ERROR

## Description

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

* 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.

### Possible solutions

* 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

* [TwiML `<Enqueue>`](/docs/voice/twiml/enqueue)
* [Queueing calls with TaskRouter](/docs/taskrouter/twiml-queue-calls)
* [Task Resource](/docs/taskrouter/api/task)
