Find stuck flows
When you start to build complex flows that go beyond simple questions and answers, you may accidentally build a stuck flow situation. This can happen when transitions leave a junction, script node, or other non-output node but cannot be traversed due to condition restraints. In exercises such as how to branch at the beginning of a flow, we advise setting up a fallback transition, in case none of the conditional transitions can be selected. We also describe in the troubleshooting page how to fix stuck flow errors when they occur in Try Out. When a stuck flow is encountered, Teneo has to abandon the flow, meaning a correct answer cannot be given.
Stuck flow errors should never occur, so if they do, you will want to find and fix them as soon as possible. Using Teneo Query Language, it is easy to find stuck flow situations and get the information needed to navigate to the flow location in Teneo, where you can analyze and repair it. In order to demonstrate a stuck flow error and how it can be solved using Teneo Query Language, we took the flow described in branch at the beginning of a flow and broke it. We added a condition to the fallback transition to make the response conditional on the mention of a tea type. So now if users ask generally about Longberry Baristas coffees, the flow will generate a stuck flow error. That is what you will see in the examples shown below.
Let's first have a look at what happens inside the session logs when a stuck flow error occurs:
In the second event with index (9), we can see that a stuck flow is registered: stuck = true. The vertex ID in the previous event (8) is the last point in the flow that Teneo reached, before becoming stuck. It was not able to continue any further from that location. Knowing that this is what is logged, we can construct a query to show us the information we need, taking care to look at consecutive events within the same transaction.
This query gives you a report of all instances of stuck flows, one for each occurrence :
1lu t.id transactionId, t.e2.fname stuckFlowName, t.e1.vid stuckVertex: 2 t.e2.pathType == "drop-flow", 3 t.e2.stuck == "true" , 4 t.e1.eventIndex == t.e2.eventIndex - 1 5
This variation shows a streamlined list (without frequencies) where you can click into the offending flows and correct them:
1lu t.e2.fname stuckFlowName, t.e1.vid stuckVertex: 2 t.e2.pathType == "drop-flow", 3 t.e2.stuck == "true" , 4 t.e1.eventIndex == t.e2.eventIndex - 1 5
If you want to include the user input to help you identify what caused the error you will need to add userInput to your query as following:
1la t.e2.fname stuckFlowName, t.e1.vid stuckVertex, t.e.userInput userInput: 2 t.e2.pathType == "drop-flow", 3 t.e2.stuck == "true" , 4 t.e1.eventIndex == t.e2.eventIndex - 1 5
The important part of the result is the vertex ID, a unique ID of the node at which the stuck flow error occurred. Here are the steps you can walk through to repair the errors you find:
Click into the vertex ID shown in the TQL results:
Examine the transitions leaving the node. Note that after clicking into the flow, the location at which the flow became stuck is highlighted.
- Make the necessary corrections and republish. In our case, this means changing the fallback transition back to unconditional. These changes will turn the flow into this.