Fix Power Automate Base64 Expression Receives a Null Value Error
Question details
The user's Power Automate flow fails at the email sending step because the base64 expression is receiving a null value from the second branch's Word template output.
- Product
- Microsoft Power Automate
- Device & OS
- not provided
- Scenario
- Using a conditional flow to select between two Word templates and sending the resulting file as an email attachment.
- Observed behavior
- The flow fails on the second branch during the 'Send an email (V2)' action, throwing an error that the base64 function expects a string, object, or array, but received a null value.
Check your flow run history and inspect the outputs of the actions immediately preceding the failed email step to confirm exactly where the null value is originating.
Verify File Identifier and Output References
Ensure that the action retrieving the second Word template successfully returns file content and is correctly referenced in the email action.
The most common cause of this error is that the 'Send an email (V2)' action is trying to convert an attachment using dynamic content from the first branch, which is empty when the second branch executes.
By correctly routing the outputs of both branches into a shared variable or adjusting the attachment reference, you ensure the base64 expression always receives valid file content.
Open the failed flow run and expand the action that gets or populates the second Word template. Verify that the 'File Identifier' is correct and that the 'Outputs' section contains valid file data.
In your 'Send an email (V2)' action, clear the current attachment content field. Re-select the dynamic content specifically corresponding to the output of the second branch's file action.
To streamline conditional branches, add an 'Initialize variable' action at the start of your flow. In each branch, use 'Set variable' to assign the specific Word template's file content to this variable, then reference only the variable in your email attachment.
Use a Coalesce Expression to Handle Missing Content
Wrap your base64 function or dynamic content in a coalesce expression to provide a fallback when the primary file content evaluates to null.
Edit and Prepare Word Templates Seamlessly with WPS Office
While debugging your Power Automate flows, you can effortlessly manage and edit your document templates using WPS Office. It serves as a highly compatible, free alternative to Microsoft Word, making document preparation fast and easy.
- 1. Download and install: Get WPS Office for free from the official website and install it on your device.
- 2. Open your templates: Launch WPS Writer and open your existing .docx templates to make modifications without format distortion.
- 3. Save and automate: Save your finalized templates to OneDrive or SharePoint so they are ready to be called by your Power Automate flows.

Frequently Asked Questions
Why does the base64 function throw a null value error in Power Automate?
This happens when the dynamic content passed into the base64 function is empty (null). Usually, this occurs when an action references a conditional branch that did not execute, or when a 'Get file content' action fails to locate the file.
How do I find out which branch or action is passing a null value?
Go to the run history of your flow, click on the specific failed run, and expand the steps leading up to the failure. Look at the 'Outputs' section of each file retrieval action to see which one contains a null or empty body.
What does the coalesce function do in Power Automate?
The coalesce function evaluates a list of arguments and returns the first one that is not null. It is highly useful for providing fallback values to prevent expressions from failing due to missing data.




