202 Status Code and the Asynchronous Pattern | Power Automate

March 27th 2020
Back to all blogs

202 Status Codes and Asynchronous Patterns in Power Automate… what are they, and how do you fix them?

On occasion, a support call is raised with Encodian, or a community user reports an error with action processing a document in some way, typically generating an error message such as:

InvalidTemplate. Unable to process template language expressions in action ‘Create_file’ inputs at line ‘1’ and column ‘2714’: ‘The template language function ‘base64ToBinary’ expects its parameter to be a string. The provided value is of type ‘Null’. Please see https://aka.ms/logicexpressions#base64ToBinary for usage details.’

An example error is illustrated below:

The critical element of the error message is: “The provided value is of type ‘Null’.

This means that a file is not being passed to the ‘SharePoint Create File‘ action, which is why it fails to create the file… but the Encodian action has succeeded, so why is a file not being passed to the ‘SharePoint Create File‘ action?

Asynchronous Pattern in Microsoft Power Automate

Whilst the Encodian ‘Convert to PDF’ action has technically succeeded, it hasn’t returned a 200 status code but a 202 status code… this is detailed on the output, which also shows that a file hasn’t been returned.

Asynchronous Pattern

Technically nothing has failed, as a 202 status code is considered a successful status code. However, a 202 status code indicates that a request has been successfully accepted, not that it has been completed! … but rather than going into a detailed explanation of HTTP status codes and asynchronous processing, we’ll focus on fixing the super simple issue!

Let’s fix this issue!

1. Open the action settings that return the 202 status code.

Asynchronous Pattern

2. Click to enable the ‘Asynchronous Pattern‘, and click ‘Done.

Asynchronous Pattern

That’s all fixed! If you’re interested, there’s some extra technical detail below for reference:

NOTE: The Asynchronous Pattern is enabled by default. This only ever becomes an issue when it has been purposefully disabled.

A bit more technical detail…

A 202 response code means that the web server accepted the request but has not yet completed processing the job. The HTTP response would include an HTTP header called ‘Location’, the value of which contains a URL the caller, should subsequently call to obtain the final result.

Any connector which processes files in Power Automate should adopt this approach (most do), as a synchronous call will timeout after 90 seconds which may not be enough time for long-running operations to complete. For example, OCR’ing a 100-page document could take 5 minutes or more.


We hope you’ve found this post useful, and as ever, please share any feedback or comments – all are welcome! If you still have a technical query, please contact our support team.

Jay Goodison

Managing Director

Back to all blogs

You might also be interested in...