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.

Customer Unable to Delete Task Queue From Taskrouter Workspace

Issue

Customer report that they are unable to delete the Task Queue from Taskrouter Workspace and getting the below error:

There was a problem deleting Task Queue. TaskQueue WQXXXXXXXXXXXXXXXXXX cannot be 
deleted since Tasks are still processing against current or 
previous versions of the following workflow configurations: 
WWXXXXXXXXXXXXXXXXXXXXXXX for Workspace WSXXXXXXXXXXXXXXXXXXXXXXXX for 
Account AC2XXXXXXXXXXXXXXXXXXXXXXXX

 

Product

Twilio Flex 

 

Environment

legacy Twilio Console

 

Cause

There can be multiple reasons behind it:

  1. Tasks are still inked to the Task Queue.
  2. Task Queue is still used in Taskrouter Workflow.
  3. When you update a TaskRouter Workflow from the Twilio Console UI, it will make a POST request with ReEvaluateTasks set to FALSE. (this will also happen if you make changes to Workflow via API and do not specify ReEvaluateTasks- because the default value is false). This means the Workflow will be updated, but the workflow logic instructions on the Tasks remain on the previous version.

 

Resolution

Step 1: 

Confirm that there are no Task attached to the Task Queue from Twilio console [Taskrouter -> Flex Task Assignment Workspace -> Tasks] or Taskrouter Workspace in OneAdmin. 
 

Step 2:

Confirm that the Task Queue is not used in any Taskrouter Workflow through Twilio console or One Admin.
 

Step 3:

When you update a TaskRouter Workflow from the Twilio Console UI, it will make a POST request with ReEvaluateTasks set to FALSE. (this will also happen if you make changes to Workflow via API and do not specify ReEvaluateTasks- because the default value is false). This means the Workflow will be updated, but the workflow logic instructions on the Tasks remain on the previous version. See below example of Workflow with two steps ("original"):

  1. Go to Queue A for 30 seconds
  2. Go to Queue B forever

We want to change that to the following ("new"):

  1. Go to Queue B for 30 seconds
  2. Go to Queue C forever

Because you used the Twilio Console to make the Workflow change, there are now lingering Tasks in the environment that still have the original (Queue A) instructions.

Continuing, you run a report and see that all your Tasks are currently in Queue B (there are no Tasks in Queue A). You think it should be okay to delete Queue A.

You try to delete Queue A, but you get the above error.
 

Why?

There could be existing Tasks that still contain the metadata instructions from the original Workflow, which mentions Queue A. Customers are not able to visibly see these underlying routing instructions on the Task, so they have no good way of deducing on their own why they are unable to delete the Queue.

But this reference to Queue A (in the underlying routing instructions on the Task) is enough to cause TaskRouter to throw an error and prevent the Queue from being deleted.
 

How can this be solved?

Update the Workflow again from the API or CLI with ReEvaluateTasks is set to TRUE, so all active Tasks have their underlying instructions updated to the new Workflow logic. 

twilio api:taskrouter:v1:workspaces:workflows:update --workspace-sid <workspace sid> --sid <workflow sid> --re-evaluate-tasks true

 

How can this be prevented?

Only make updates to Workflows from the API and ensure that ReEvaluateTasks is set to TRUE, so all active Tasks have their underlying instructions updated to the new Workflow logic. 

Have more questions? Submit a request
Powered by Zendesk