Many running flows in Power Automate

Recently I noticed that some of my flows end up with many running flows.

Types of flows

There are a few different types of flows

  • Manual cloud flows
  • Scheduled cloud flows
  • Automated cloud flows

When I looked into the issues of many flow runs, I found that they were always scheduled flows.

And whenever I would open the flows there would be an apply to each that was stuck.

The difficult thing is that when you open up the apply to each , you will not find out what is actually happening.

How can we debug this?

3 steps to debugging multiple running flows

I’m going for the following approach:

  1. Stop the flow
  2. Find clues and fix the flow
  3. Restart the flow

To stop the flow I first go to the flow and select the turn off option.

This will stop any new instances starting up.

You could now cancel all the flow instances that are running. This can be a really boring job, but it might have to be done at some point. However this is not the right moment, as I want to see where the flows are failing/hanging or timing out.

In the All runs, you will find the Running flows but also some failing or maybe successful flows.

In my case I have some failing flows. When I look at my failing flow I found a delay action failing.

Gosh, what is this about? If we can’t even wait properly then what can we do.

The error that goes with this failure says:

The provided ‘Wait’ action ‘interval’ value ‘1’ ‘Second’ is not supported for the ‘Consumption’ SKU. The value must be between ‘5’ seconds and ’30’ day(s).

Ok, so I’ve got a trial that has expired and now I’m only allowed to wait for 5 – 30 seconds. The reason for he delay was to reduce the pressure on the SharePoint connector a bit. So in this case waiting for 5 seconds probably isn’t too bad.

But this doesn’t explain why the flows are suddenly never finishing or does it?

Well, you might have noticed recently all sorts of warnings in flows that tell you when there are too many failures or too many actions run by your flows.

Have you noticed that in the apply to each steps, if any action fails, that the apply to each simply continues? In my example above one flow run would generate 465 errors. On a scheduled flows that will quite quickly result in many errors.

Looking at the analytics of the flow you can quite quickly notice that there is something wrong!

When you get too many errors, apply to each steps seem to go into a never ending pause state.

So what should we do?

  1. avoid errors inside large apply to each steps.
  2. protect your flow from running multiple instances (unless it is a requirement for this to happen)
  3. avoid apply to each steps, where possible
  4. buy a premium licence 😉 as it avoids issues like mine

Now the next step is to cancel the running flows and restart my flow.

So how do we protect our flow?

Protect a flow and stop many running flows issues

To stop the issues of many running flows you could create a SharePoint list. Call this list locks or something like that and create one item in this list.

At the start of the flow read the item and check the value of the item. If it is locked then don’t run the following steps. You can do this using a condition step.

Then within the code that you want to run set the item to locked. And at the end of your flow write to the lock item and set it to unlocked.

Then finally you might want to send yourself an email when the flow is trying to start while the flow is already running.

This way of protecting your flow might not fix the issue, but it does avoid you having to cancel 100s of flows running.

Share
Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using contact@veenstra.me.uk.

View Comments

  • This article highlights perfectly why Flow is not suitable for Enterprise deployments. It is unacceptable if a flow contains no errors, then throws exceptions like the above because of tenant load/timings/preview actions. Too many actions have been in 'Preview' for years meaning MS can delete/modify them when they choose - list the Teams actions to see what I mean! It is about time MS focus on finishing existing features rather than rollout new ones as they try and compete in the consumer sector #fail

  • Hi Pieter,
    Regarding the last part - doesn't simply setting concurrency control of the trigger to 1 solve the issue of multiple running flows?

    • Hi Michal,

      The approach would be fairly similar however, in my case I would also like to know when a previous run is taking too long. Hence if I get the flow rather than the trigger to control this I can for example send myself an email with an alert. Rather than letting the longer running flows just happen.

Recent Posts

Create a Microsoft Teams team template

Recently I was asked about creating a team template in Microsoft Teams and apply this…

1 week ago

Who is in the office tomorrow, using Power Automate?

Do you want to know who is in the office tomorrow or the day after?…

2 weeks ago

8 top reasons to use Dataverse or SharePoint lists in the Power Platform

Why would you use Dataverse, if SharePoint lists gives you the option to avoid premium…

4 weeks ago

Filter by calculated fields in SharePoint using Power Automate

When you read items from a SharePoint list and you want to filter by calculated…

4 weeks ago

Expected String but got Null, when calling a flow from a Model Driven app

A few weeks ago I looked at calling flows from model driven apps. And for…

1 month ago

Get all your broken connections using Power Automate

To get all your broken connections in the Power Platform can be a challenge. In…

1 month ago
%%footer%%