Photo by Michael Dziedzic on Unsplash

Troubleshooting Power Automate Desktop error codes

I am working with Power Automate Desktop for more than a year now. Over that time I faced a lot of weird errors that were occurring somewhere between cloud flows I used to trigger RPA and the bots themselves. Let me help you understand where are they coming from and how to resolve them (or create workaround).

In this post I am focusing on errors which may occur in attended or unattended Power Automate Desktop runs basically on the connectivity layer, when those instances are triggered by cloud flows. Errors may occur in both directions, when cloud flow is triggering desktop flow and later when desktop flow is trying to send data back to cloud flow which triggered it.

Errors in Power Automate Desktop

Whenever an error occurs in desktop flow, it is being returned as the below JSON object:

    "error": {
        "code": "[INTERNAL CODE]",

Codes are obviously unique and are the most important information that helps us to debug and troubleshoot. I will now focus on those that I have been facing the most often.

Troubleshooting errors in Power Automate Desktop

Error code: NoCandidateMachine

Status code: 400

When? This error occurs when cloud flow cannot connect with any saved machine for a longer than three hours. The error may occurs even if the machine is online, but for some network issues (or possibly a local firewall on the machine) cloud flow is unable to reach it using machine registration saved information. It always occurs before a desktop flow is actually executed.

How to fix? You can of course contact Microsoft support to help you troubleshoot network issues in such case. What I am doing are two things: change retry policy in actions’ settings and re-trigger desktop flow as long, as such error is not returned:

With such retry policy action in case any 5xx issue occurs, flow will try to retry on its own. And the second trick:

Is to examine if the response body from PAD action contains specific error schema. If yes, whether the “code” is equal to “NoCandidateMachine“. In such case I put flow on hold for 5 minutes and then it tries to trigger PAD again. The loop ends when either PAD completes without an error, or a different kind of error code is returned.

Error code: NoListenerConnected

Status code: 400

When? This error again occurs when cloud flow tries to trigger desktop flow, but due to network issues it cannot reach the machine. I don’t know exactly what is the difference, but what I found so far is that this error occurs only at the initiation phase, so not during the desktop flow execution.

How to solve it? I decided to implement a similar workaround for this scenario as I described above. So I simply extended the mechanism for NoCandidateMachine to handle other scenarios:

As you can see, here variable that is used to evaluate whether the loop should be terminated is simply a string that contains ERROR or not. So in case any from the mentioned errors occurs, cloud flow is again put on hold an then tries to re-trigger desktop flow again.

Error code: ConnectionNotEstablished

Status code: 400

When? Error most probably occurs due to some network/ connectivity issues between the cloud and machine where bot should be executed. I haven’t yet figured out the root case of that behavior. The good thing is that it happens when bot is being initialized, so no work is done yet.

How to solve it? I recommend to go for the same solution as mentioned above – so to trigger PAD action as long as it doesn’t return the error.

Error message: Desktop flow execution failed. CorrelationId: ‘00000000-0000-0000-0000-000000000000’

When? Error occurs unfortunately during desktop flow execution. And (for my case) only at the end of the PAD instance, so when bot is trying to save its execution log back to cloud and return output variables’ data or info about errors. This issue is very troublesome, because it actually causes cloud flow to fail even though desktop flow might have completed successfully. Moreover when you navigate to “Desktop flows runs monitor” there is not going to be any history for that instance available 🙁

Important! Before I tell you how to solve it, you can always find a specific instance details when you sign in to a machine where bot was executed (preferably with the same account as used for connection) then navigate to: %LOCALAPPDATA%\Microsoft\Power Automate Desktop\Scripts, there find a folder with a guid equal to guid of the desktop flow definition. Inside a folder navigate to \Runs\ and there look for a folder with a guid equal to the guid of a specific instance of that desktop flow. Inside that folder you’ll find a file “Actions.log” that contains a JSON with the full instance history.

How to solve it? Unfortunately there’s no easy way to solve it. You need to figure out a way to check, within your cloud flow, if that specific desktop flow actually ended up successfully or with an error. What I do is additional logging and extended error handling within desktop flows. Each instance creates a separate Excel file, that is used by desktop flow to write information from its run. Last row is always either info, that bot completed successfully or information about caught exception. Then, in cloud flow process is exanimating that Excel file’s last row to check if there was an error or not:

In case of anything different than “RPA completed” in last row’s message, cloud flow is considering that desktop flow’s instance as failed and acts accordingly. In all other scenarios it proceeds the “happy path”.

Error code: ActionRuntimeError

Status code: 400

When? Error can be supplemented with i.e. message: “Runtime Error: Exception of type 'System.OutOfMemoryException' was thrown. - issue related to machine“. As above. This issue can occur anytime during desktop flow execution. It is much more problematic as the one mentioned above. When it occurs, it simply terminates desktop flow instance that may be even in the middle of some transaction. It happens due to problems on the machine where bot is executed. For example, insufficient resources: RAM, HDD etc… It may be that bot is gathering a lot of data during the run (like creating a large text variable by appending it with strings through the whole instance) and exhausting resources.

How to solve it? Obviously examine what was the error reason. Possibly you can fix it by adding some more resources to the machine. Unfortunately I don’t have an easy to implements solution. In fact, you need to check on what action bot failed and based on that choose the best approach for re-triggering it. For example, if it was processing a list of records, it would be better to trigger it for only unprocessed records. Naturally, for this case your custom logging may be useful too, like if bot is updating a list of processed records, it can later pass it to cloud flow, which could be then able to re-trigger bot for the remaining records.

Error code: SessionNotFound

Status code: 400

When? In my case this error was occurring only when cloud flow was trying to trigger desktop flow. It was supplemented with a message: “Can't find target session“. I was advised to check, if machine where desktop flow was meant to be ran, wasn’t created through “clone” procedure in Azure. In my case it was. And the reason this error was occurring was that many machines were actually registered under the same identifier so cloud wasn’t able to find that specific one.

How to solve it? Simply re-register the machine that is causing the error. To do it, navigate to that machine, in its “Machine registration” settings connect it to a different environment and then back to the one, where it is supposed to be available. In the end, refresh defined connections in related Power Platform environment.

Error code: RunFlowFailedError – Timeout has expired

Status code: 400

When? Error is supplemented with a message: “Failed to run flow \r\n Timeout has expired.“. The error can occur when using a “Run desktop flow” action within a desktop flow (that triggers another desktop flow) and that other desktop flow is running too long (exceeding the timeout). Again – it is a troublesome error, since it happens during desktop flow execution.

How to solve it? Like with the “ActionRuntimeError” you need to first check what was the root-cause of the error and then react accordingly. Navigate to “Desktop flow runs” monitor and check failed desktop flow instance to find out on which action it failed and possibly why – having hopefully a screenshot to help you.

Error code: RunFlowFailedError – An error occurred while executing flow Stack empty.

Status code: 400

When? Error is supplemented with a message: “Failed to run flow \r\n An error occurred while executing flow Stack empty.“. The error can occur when using a “Run desktop flow” action within a desktop flow (that triggers another desktop flow) and that other desktop flow was updated and saved using a higher PAD Designer version than the one that is used to trigger it.

How to solve it? In my case what was sufficient was to simply upgrade PAD version on the machine, where both parent and child desktop flows were executed.

Other errors

If you have faced any other error type, please let me know in comments, I’d love to update the post and include resolution steps you have made.

Also, there is a list of known errors at Microsoft Docs, so if you can’t find solution in this post, maybe you’ll have more luck there. Just navigate to: Windows sessions and UI flows and attended/unattended behavior – Power Automate | Microsoft Docs.

Tomasz Poszytek

Hi, I am Tomasz. I am expert in the field of process automation and business solutions' building using Power Platform. I am Microsoft MVP and Nintex vTE.

  • Arul Manohar E


    After migrating a solution from dev to prod, as managed solution

    March 29, 2022 at 1:25 pm Reply
    • Tomasz Poszytek

      Hi, I personally haven’t faced such error. Check if: DLP is not blocking desktop flows, and if on the target machine for prod, you have installed Power Automate Desktop components.

      April 12, 2022 at 8:01 am Reply
  • Asam

    There’s an issue starting your desktop flow. Check for errors and try running it again. Error returned: “Cannot create new session to execute unattended run.”

    April 19, 2022 at 12:19 pm Reply
    • Tomasz Poszytek

      I would suggest signing in to the machine where bot should run and to check if there’s any file in logs folder (%LOCALAPPDATA%\Microsoft\Power Automate Desktop\Console\Scripts) – navigate to script folder of your PAD and then to Runs/ and subfolder of the instance that failed. If there is anything created, means the PAD actually reached the machine. However I feel it hasn’t? After you ran it again – did it trigger?

      April 26, 2022 at 1:30 pm Reply
  • Marek

    Fantastic work, Tomasz. Thank you for sharing your knowledge and experience!
    I have ran across the below *during* PAD flow execution, did not troubleshoot yet but will need to take a look soon.

    “The endpoint was not found. None of the connected listeners accepted the connection within the allowed timeout. Check that your machine is online.”

    June 18, 2022 at 11:17 am Reply
    • Tomasz Poszytek

      I am facing that issue too. No idea unfortunately where it is coming from. You may try to re-register the machine to environment.

      June 23, 2022 at 8:29 am Reply

Post a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.