“I can’t save the Power Automate flow I just built, it shows me the maximum nesting limit of ‘8’ error, how can I solve it?”
“The power flow’s logic app flow template was invalid. The template actions ‘xxx’ are nested at level ‘9’ which exceeds the maximum nesting limit of ‘8’.”
Even though Power Automate allows you to build very complex flows, it has limits. One of them is how deep you can go using the control actions like the ‘Condition’, ‘Apply to each’, ‘Switch’, etc. Each of these actions inside another one adds a new nesting level in the flow. Once you overcome the 8th nesting level, you won’t be able to save the flow. All the work you did on the flow could be lost just because of that.
This post will show you some solutions how to stay within this limit.
Use configuration list(s)
If the nested levels are caused mostly by ‘Condition’ actions, you should consider using a configuration list. Instead of many comparisons you could have a single lookup to find the corresponding value right away.
Reduce the number of ‘Apply to each’ actions
Every time you process an array in Power Automate, it’ll add ‘Apply to each’ automatically. But sometimes, e.g. when processing approval task response, it’s only a single item in this array and you don’t need a loop. While it’s ok to keep it in the flow as it’ll run only once anyway, you can save one nesting level if you remove it.
Check your flow for such ‘Apply to each’, maybe there’s one that you could remove.
Reduce the number of ‘Condition’ actions
From time to time you use ‘Condition’ only to change a value in the same action. Update a SharePoint field with a different value, send an email to different user, etc. In such situations you don’t need the ‘Condition’ action, you can use the if(…) expression instead as explained in the date formatting article.
Redesign the flow
Another approach, which is a bit more time consuming than the two above, might be to redesign the whole flow. Maybe you don’t need so many nested ‘Condition’ and ‘Apply to each’ actions. The flow could work just as well if you separate them – condition 1: do something; condition 2: do something else.
The Power Automate nesting limit error is not something you can disable. You must solve it, and it’ll require a change in your flow. It can be a big change as changing the whole flow design, or it can be a smaller change when you just replace a ‘Condition’ or an ‘Apply to each’ with an expression. The outcome is clear – maximum 8 nested controls, and it’s up to you how you achieve it.