Australian cloud for business software — built and run in Sydney since 2002

NetLeverage
NetLeverage

Power Automate "InvalidTemplate. Unable to process template language expressions": what each message means and how to fix it

Technical article
Troubleshooting

About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.

A flow run that stops with "InvalidTemplate. Unable to process template language expressions" has an expression that Power Automate could not evaluate. The rest of the message says why. Microsoft's pages show three common reasons: a value of type 'Null' reaching an expression, a property that cannot be selected or does not exist, and a name in the expression that does not match an action or connection. The fix depends on the reason, so read the message to the end before editing anything.

What the error means

In a failed run, the full message names the action, the position inside the action's inputs, the expression, and the reason. Microsoft's Power Apps flow integration page shows two examples:

  • "Unable to process template language expressions in action 'Send_me_a_mobile_notification' inputs at line '1' and column '1900'", followed by an expression "cannot be evaluated because property 'Sendmeamobilenotification_Text' cannot be selected".
  • "Unable to process template language expressions in action 'Send_an_email' inputs at line '1' and column '1899'", followed by an expression that cannot be evaluated because "property 'shared_office365' doesn't exist, available properties are 'shared_flowpush'".

Both end with a pointer to https://aka.ms/logicexpressions for usage details. Microsoft's null fields page gives a third form: "InvalidTemplate. Unable to process template language expressions. The provided value is of type 'Null'."

Microsoft's cloud flow error reference lists InvalidTemplate as a design-time error, raised when you save, validate or publish, and ExpressionEvaluationFailed as the runtime error, for data that cannot be checked at save time. It adds that an expression made only of constants, such as int('abc') or div(100, 0), is caught at save time as InvalidTemplate. The null fields page shows the InvalidTemplate text in a flow run, and the integration page shows the "Unable to process template language expressions" text. Our own reading: when the message appears in run history, work from the reason it gives and not from which of the two names Microsoft files it under.

Likely causes

Cause What you see How to confirm
A null value reaches an expression that needs a string, object or array "The provided value is of type 'Null'" The failed action's inputs show an empty or missing value
A property that the data does not carry The expression "cannot be selected" Compare the expression with the trigger's or action's output in the run
A flow updated to use a new connection while the app still holds the old flow metadata A property that "doesn't exist, available properties are" followed by a list The message's list of available properties against the connections the flow now uses
A name typed differently from the action The expression reads an action output that does not exist Names are case-sensitive and use underscores: outputs('Get_item'), not outputs('Get Item')
Hidden characters pasted into the expression An expression that looks correct still fails Retype the expression by hand and compare

Prove the cause before changing anything

All of these steps only read.

  1. Read the whole message. Open the failed run, select the failed action, and copy the message. Note the action name, the line and column, and the reason the message gives.
  2. Match the clause. "The provided value is of type 'Null'" is a null problem. "cannot be selected" or "doesn't exist" is a name or schema problem. A clause that lists available properties shows which properties the expression can read.
  3. Read the values. Microsoft's error reference says to open the failed run and select the failed action to display the expression and input values. A good result shows the one input that is empty or absent.
  4. Check the names. In the expression, compare each action name with the action's name in the flow. Microsoft's error reference says names are case-sensitive and that spaces become underscores.
  5. If a Power Apps app calls the flow, list what changed in the flow since the app was built. Microsoft lists the changes most likely to break the call: adding a new Ask in Power Apps token, adding a new connection, changing an existing connection, and removing an output from a Respond to Power Apps action.

Example (illustrative): at Example Pty Ltd, a flow sends an email for each new row in a list. The email body is triggerBody()['Notes']. About 40 rows arrive a day and 3 of them have no value (null) in Notes, so 3 ÷ 40 = 7.5 per cent of runs fail with "The provided value is of type 'Null'". In a working week of 5 days, 3 × 5 = 15 runs fail.

Fix

For a null value, Microsoft's null fields page gives two resolutions. The first is to add a Condition action that checks the value, using "is not equal to" with the value null. The second is the coalesce function, which supplies a default when a value is null. The expression functions page says coalesce returns the first non-null value, and that empty strings, empty arrays and empty objects aren't null. Microsoft's error reference shows coalesce(outputs('Get_item')?['body/title'], 'Untitled'). The null fields page adds that a runtime error can remain after coalesce when an expression references null properties in an object, and says: "You can use the question mark operator (?) to handle null outputs from a trigger." Its example is @coalesce(trigger().outputs?.body?.<someProperty>, '<property-default-value>').

For a name or connection problem, Microsoft's error reference says to correct the name, or to retype an expression that might hold hidden characters. For a syntax error, it lists unmatched parentheses or quotes, an action output that does not exist, and a function given the wrong number of arguments, such as createArray() with none, and says to open the action highlighted in red in the designer and check the expression in the formula bar. For a flow called from Power Apps, the integration page describes a different repair. For a published app, the page says: "When your app is already published and in use, always create copies of flows before making updates. Updating flows directly can break the app for existing users." So copy the flow with Save As, change the copy and point the app at it. For an app still in development, change the flow, then remove it from the app's Flows pane and add it back. These are changes to the app, not to the flow's expressions.

For the null example, the edit is to the Body input of the email action.

Write down the current expression of the Body input and the time.

Risk: Editing the Body expression in a live flow changes what recipients see. For rows with no value in Notes, the email will now carry the default text, so recipients see "No notes" where the flow used to fail. An empty string is not null, so a row whose Notes holds an empty string passes through unchanged. Our own reading: check whether any later action treats the default text as real data.

Replace the Body input expression with:

coalesce(triggerBody()?['Notes'], 'No notes')

To undo it, set the Body input back to the expression you wrote down. The change you made is lost, and the 3 rows in 40 with no value in Notes fail again.

Confirm the fix

  1. Create a test row with no value in Notes. The run succeeds, and the email shows "No notes".
  2. Create a test row with a value in Notes. The email shows that value, not the default.
  3. Open the run's failed action from before and compare: the message no longer appears for new runs.
  4. After a day, count failed runs: in the example, 3 of 40 should drop to 0.

What to watch afterwards

  • Other actions that read the same property. A null that failed one action can fail the next.
  • Changes to a list's columns, a trigger's schema or a connection. Each can change what an expression can read.
  • Apps that call the flow. Microsoft says apps hold a copy of the flow's inputs, connections and outputs, so a change to any of them can break earlier app versions.
  • Expressions pasted from documentation. Microsoft's error reference names invisible Unicode characters as a cause.

Risks and limits

Sources