Fix the InvalidTemplate error in Power Automate
InvalidTemplate means Power Automate could not work out an expression in the action the message names. The full text names the action, for example: Unable to process template language expressions in action 'Send_an_email' inputs at line '0' and column '0', followed by the reason. The cause is a typo, a wrong action name, a function used the wrong way, or a value that is empty or the wrong type. Open that action, read the expression, and fix it. Wrap values that can be empty in coalesce(), and use ?[ ] for properties that may be missing.
What the error means
An expression is a short formula inside a flow. It sits in an action field and starts with an equals sign or an at sign, such as the one that builds an email subject. The flow reads the formula, works out the answer, and passes it on. When it cannot work out the answer, it stops and shows an error with the action name in it.
Microsoft's troubleshooting page says: "If the error says "Invalid template" or "Unable to process template language expressions," open the action and check each expression."
Microsoft's error reference describes InvalidTemplate this way: "The flow definition contains a syntax error in an expression or action configuration." It lists these causes:
- "Unmatched parentheses or quotes in an expression"
- "Referencing an action output that doesn't exist (typo in action name)"
- "Using a function with the wrong number of arguments (for example, createArray() with no arguments)"
The same page describes a second error, ExpressionEvaluationFailed, as one that happens when the flow runs and "the actual data didn't match what the expression expected." Its causes include "Accessing a property on a null object". The two names look alike, and the fix steps overlap, so this guide covers both. Exact names may differ on your screen.
Save time or run time
Microsoft's error reference puts InvalidTemplate under "Design-time errors," which it says "occur when you save, validate, or publish a flow." It puts ExpressionEvaluationFailed under "Runtime expression errors," which "occur when a flow runs and an expression can't be evaluated."
Microsoft adds a note: "If an expression uses only constant values (like int('abc') or div(100, 0)), the flow engine catches the error at save time as InvalidTemplate instead." So the same bad idea shows up under a different name depending on whether the value is fixed text or comes from a variable, trigger or earlier action. Your run history can still show InvalidTemplate on a run that failed. A Microsoft Q&A question shows it on a Create HTML table step, with the message "InvalidTemplate Unable to process template language expressions in action 'Create_HTML_table' inputs at line '0' and column '0'". That thread is community help, not a Microsoft support article. Treat it the same way: read the expression, then the value that went in.
Common causes of InvalidTemplate
- An opening parenthesis or quote with no closing partner.
- An action name that does not match, such as a typo or spaces where underscores belong.
- A function with the wrong number of inputs, such as createArray() with nothing inside.
- A bad constant expression such as int('abc').
- Hidden characters from a formula copied off a web page.
The example used in this guide
Say your team has a SharePoint list called Support requests. It has these columns:
- Title
- Priority (Choice: 1 High, 2 Medium, 3 Low)
- Notes (Single line of text)
A flow runs when someone adds a request. It sends an email with a subject built from the Title and the Notes. When Notes is left empty, the flow fails with an error that names the email action. The steps below find why and fix it.
Step 1. Find the action that failed
- Open https://make.powerautomate.com and sign in.
- Open your flow and open its run history.
- Open the failed run. The action with the red mark is the one named in the error.
- Open that action and read its inputs and outputs.
Microsoft's error reference says: "Open the failed run and select the failed action to display the expression and input values." Exact names may differ on your screen.
Step 2. Read the expression
Look at the field that holds the formula. Check these things in order:
- Count the opening and closing parentheses. They must match.
- Count the single quotes. Each opening quote needs a closing quote.
- Check each function name for typos.
- Check the action names inside the formula.
Microsoft gives a tip for action names: "Action names in expressions use underscores instead of spaces. If your action is named "Get item", the expression reference is outputs('Get_item')." Microsoft also says the match is case-sensitive: outputs('Get_item') not outputs('Get Item').
Microsoft's fix list for InvalidTemplate also says: "If the expression looks correct, delete it and retype it manually to remove hidden characters." It names one cause of hidden characters: "Copy-pasting expressions from documentation that includes invisible Unicode characters". So if you copied a formula from a web page, retype it.
Step 3. Check for an empty value
If the formula looks right, the data may be the problem. In our example the Notes column was left empty. The formula that joins Title and Notes may then get nothing where it wants text.
Microsoft's troubleshooting page lists "Null values" as one mistake and says to "Add a coalesce() or if(empty(...)) check." Its table of messages shows one that fits this case: "Invalid type. Expected String but got Null." Microsoft's translation: "A field you're referencing is empty (null) and the action expects text." Its fix: "Wrap the reference in coalesce(field, '') or add a condition to check for null first."
To see which value is empty, open the failed run and compare it with a run that worked. Look at the trigger output. Find the Notes field. Note how an empty one is written.
Step 4. Guard the value with coalesce
Microsoft's Azure Logic Apps functions reference, which also covers Power Automate, describes coalesce() as a function that will "Return the first non-null value from one or more parameters." Microsoft's cookbook gives this pattern:
coalesce(triggerBody()?['optionalField'], 'default value')
Microsoft explains it: "If optionalField is null, returns 'default value'. If it has a value, returns that value."
For our example, the Notes value gets a fallback. This formula uses the Notes column from a "When an item is created" trigger:
coalesce(triggerOutputs()?['body/Notes'], 'No notes')
The path "triggerOutputs()?['body/Notes']" is our advice about how to point at the column. It is not a Microsoft rule. Your column may use a different internal name, so confirm it in the run history from Step 1.
Microsoft also warns about a limit: "coalesce() only handles null, not empty strings." So coalesce() does not help if the field holds an empty text value. Microsoft's Azure Logic Apps functions reference agrees: "Empty strings, empty arrays, and empty objects aren't null."
Step 5. Guard with an empty check when text can be blank
For a blank text value, Microsoft's cookbook gives this combination:
if(empty(triggerBody()?['field']), 'default', triggerBody()?['field'])
Microsoft adds that "The empty() function returns true for both null and empty string ''." For our example:
if(empty(triggerOutputs()?['body/Notes']), 'No notes', triggerOutputs()?['body/Notes'])
Read it from left to right. If Notes is empty, use the words No notes. If not, use the Notes text. Our advice, not a Microsoft rule: a text box holding only a space is not empty, so you may also want to trim the value before the check.
Microsoft lists one more limit for empty(): "empty() doesn't work on numbers. empty(0) throws an error." If the field is a number, do not use empty() on it.
Step 6. Use the question mark when a property may be missing
In the formulas above, you see a question mark before a bracket, such as ?['Notes']. Microsoft's cookbook says: "Don't forget the ? (safe navigation). body('HTTP')['data']['items'] throws an error if any level is null. Always use ?['key'] to safely traverse: each ? returns null instead of failing if the parent is missing."
So if you wrote triggerOutputs()['body/Notes'] without the question mark, add it. The question mark makes a missing value come back as null. Then coalesce() can handle it.
Step 7. Check where the data comes from
Microsoft's troubleshooting page names a different cause: "Referencing dynamic content from a step that didn't run (inside a condition branch that wasn't taken)." Check that the action you point at ran in this run. If it sits inside the "If yes" branch of a condition, and the flow took the "If no" branch, its output does not exist.
Microsoft's error reference also lists a related cause: "An expression references a dynamic content value from a parallel branch (not guaranteed to exist)".
Step 8. Check the data type
Microsoft names this too: "Using the wrong data type (passing a string where a number is expected)." Open the failed action and compare what the value is with what the field wants. Microsoft's reference suggests: "Validate data types before conversion: if(isInt(variables('input')), int(variables('input')), 0)."
Step 9. Save and test again
- Save the flow. Microsoft's save-error steps say to look for red outlines on actions in the designer. Fix those first.
- Add one new test item with Notes left empty.
- Add a second test item with Notes filled in.
- Open both runs. Both should show green marks.
Microsoft gives a tip for finding where a value goes wrong: "Add **Compose** actions at key points in your flow to inspect intermediate values." Set the Compose input to the value you want to look at, run the flow, then read each Compose output in the run history. Remove the extra Compose actions when you are done.
Does the flow checker catch it?
Partly. Microsoft's error reference says of FlowCheckerError: "The flow checker found one or more validation issues that prevent saving." Its fix steps end with "Save again. The checker runs automatically on save." That covers save-time problems. A value that is empty only when the flow runs can pass the check and fail later, so test with an empty field.
Where to find null-safe patterns
Microsoft's expression cookbook for cloud flows collects ready-to-use patterns with null-safe handling. Link: https://learn.microsoft.com/en-us/power-automate/expression-cookbook
What to avoid
- Do not fix the error by deleting the whole action. Find the one bad expression first.
- Do not paste formulas straight from a web page without retyping them. Microsoft names hidden characters as a cause.
- Do not use coalesce() on its own for text that can be blank. Microsoft says it skips only null.
- Do not use empty() on a number.
- Do not turn off the flow checker warnings to get the flow to save. Fix the field the warning points to.
- Do not test only with a full item. Test with an empty field too, since that is where this error shows up.
For other flow errors, see these guides:
- Error: "An action failed. No dependent actions succeeded."
- Power Automate condition to check if a field is empty
- My condition on a choice column always goes to No
When to get help
You can build all of this yourself in Microsoft 365. If you would rather have it built and tested for your team, I do that. A tracker like this is a fixed price: $5,000 for one, built in 2 weeks. See "What a SharePoint tracker costs to build". Bring one example of the problem to a free call.
I am Al Davies. I run 250 High Street LLC and build SharePoint trackers and Power Automate flows for operations teams. I work remotely. The first call is free, and I will not try to sell you anything.
See trackers I built: Tools I built
FAQ
What is the InvalidTemplate error in Power Automate?
It means an expression or action setting could not be processed. Microsoft's error reference lists unmatched parentheses or quotes, a wrong action name and a wrong argument count as causes, and files it with errors that show when you save. The same name can also show in run history when a value is empty or the wrong type, so read the expression and the input.
Does the flow checker catch it before saving?
For save-time problems, yes. Microsoft says "The checker runs automatically on save." A value that is empty only during a run can still fail later.
Where can I get help with Power Automate expression syntax?
Microsoft's expression cookbook for cloud flows has ready-to-use patterns, and its Azure Logic Apps functions reference describes each function.
Does coalesce() fix an empty text box?
Not by itself. Microsoft says "coalesce() only handles null, not empty strings." Use an if() with empty() for blank text, as in Step 5.
Why does the error name an action I did not build?
The error names the action whose field holds the bad expression. Open that action and read each field. The empty value may come from an earlier step, so also check the run history for that step.
Sources
- Microsoft Learn, Troubleshoot cloud flow errors
- Microsoft Learn, Cloud flow error code reference
- Microsoft Learn, Expression cookbook for cloud flows
- Microsoft Learn, Reference guide to workflow expression functions in Azure Logic Apps and Power Automate
- Microsoft Q&A, Power Automate Error: InvalidTemplate Unable to process template language expressions in action