Want to fix the InvalidTemplate error in Power Automate? Yeah, we’re not surprised!
We receive more support calls than we’d like where the following error is generated running a Flow instance: InvalidTemplate. Unable to process template language expressions in action
Some example errors are detailed below:
InvalidTemplate. Unable to process template language expressions in action 'Convert_HTML_to_PDF' inputs at line '1' and column '2622': 'The template language expression 'json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$connections']['shared_encodiandocumentmanager']['connectionId']' cannot be evaluated because property 'shared_encodiandocumentmanager' doesn't exist, available properties are 'shared_onedriveforbusiness, shared_sharepointonline_2'. Please see https://aka.ms/logicexpressions for usage details.
InvalidTemplate. Unable to process template language expressions in action 'Merge_Word_Documents' inputs at line '1' and column '2722': 'The template language expression 'json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$connections']['shared_encodiandocumentmanager_1']['connectionId']' cannot be evaluated because property 'shared_encodiandocumentmanager_1' doesn't exist, available properties are 'shared_sharepointonline, shared_approvals, shared_office365, shared_wordonlinebusiness'. Please see https://aka.ms/logicexpressions for usage details.
But note this error is not specific to the Encodian connector, it affects all connectors in Power Automate:
This error is not caused by an issue with the action or the configuration of the action… and there are two super quick approaches to resolve:
Option 1 – remove InvalidTemplate with ‘Use new Test Data’
This issue typically occurs whilst you are building flow solutions and is typically caused by re-using previous run data. Just simply try using new data to test your flow!
If this quick fix doesn’t work, try option 2.
Option 2 – ‘Save As’ a new Flow
Use the ‘Save As’ feature to save your corrupt Flow as a new Flow, this process should fix any broken connections.
If this issue is affecting a PowerApp connected Flow then you may wish to simply disassociate and then re-associate the Flow which typically fixes the issue without needed to create a new flow using the ‘Save As‘ feature.
If you’re still having issues you may also try the following:
- Close your browser session, re-open the Flow in a new session and re-run the Flow.
- Remove the offending action and connection, re-add your action and repeat step #1
- Export and then re-import your Flow.
If you’re unsure how to export / import Flows please refer to the following guidance on Microsoft’s website.
We hope this helps you fix the InvalidTemplate error in Power Automate 🙂
Thanks for this post.
Occasionally I will have to change a connector from one account to another, and sometimes (usually when I’m in a hurry) this kind of error, where Flow adds an “_1” or “_2” to the connection parameters, then shows up.
Why? How does it manage to do that?
Do you have any idea how to prevent this?
Hi Michel, this is not something I’ve seen personally… one to raise with the P/A community
Nice! The Manual test worked. Is there any way I can succesfully resubmit the failed ones? I tried to resubmit, but they fail again.
No, you cannot re-use old data to test with. HTH