SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

Error 20412: Precondition failed for Sync / TaskRouter updates

Issue

The resource does not meet one of preconditions defined by the request when a Sync List Item or a Task is updated.

Product

Sync, TaskRouter

Cause

This error occurs when a request's preconditions are not met. This status code is part of 4xx class of HTTP status codes, which indicate client-side errors. In the context of Twilio, this error might arise if certain preconditions specified in a request are not satisfied before the server can process the request and often relates to the ETag mechanism used for concurrency control. It indicates that the If-Match header value does not match the current ETag value, leading to a conflict when attempting to update a resource.

Resolution

When dealing with real-time updates some Twilio API resources utilize the If-Match and ETag HTTP headers for conditional mutation. Every response containing these objects will return an ETag value, which you can compare against an If-Match header.

The following resources currently support this form of conflict resolution: 

You can use the If-Match header to check that the version of the Resource is up-to-date before sending your update through. First, GET the Resource to retrieve the ETag header. Then pass this revision as a value in the If-Match header when you POST your update. This ensures that, if you are not referencing the most up-to-date revision, the update will be rejected.

Additional Information 

An example of updating a Task resource is explained here: REST API: Mutation and Conflict Resolution

 

 

Have more questions? Submit a request
Powered by Zendesk