How to Fix Power Automate Attachment Name Cannot Be Empty Error
Question details
The user needs to fix an email automation error where the flow fails because the attachment name is missing or invalid.

- Product
- Power Automate
- Device & OS
- not provided
- Scenario
- Adding file attachments to an email using the Send an email (V2) action in a workflow.
- Observed behavior
- The flow execution fails, reporting the error message that Attachment Name cannot be null or empty.
Verify that your flow is correctly pointing to the source file or list item, and ensure that the item you are retrieving actually contains an attachment.
Rebuild the Attachment Array Object Properly
Retrieve the attachments from the newly created destination item and map the DisplayName and ContentBytes correctly into an array variable before sending the email.
The Send an email (V2) action requires a strictly formatted array object for attachments. If the flow retrieves attachments from a source, you must ensure that both the name and the binary content are explicitly extracted and appended to a variable.
Insert a 'Get attachments' action into your flow to fetch the attachment metadata from the target list or file location.
Add a 'Get attachment content' action to retrieve the actual file binary data for the specific attachment.
Create an 'Append to array variable' action. In the value field, construct the JSON object like this: { "Name": "@{item()?['DisplayName']}", "ContentBytes": "@{body('Get_attachment_content_2')}" }.
In your 'Send an email (V2)' action, switch the Attachments field to array mode (using the T-shaped icon) and insert your completed array variable.

Looking for a Lightweight Office Solution? Try WPS Office
While troubleshooting complex Microsoft automation flows, you may want an easier, seamless alternative for your daily document editing needs. WPS Office is a comprehensive, free office suite that makes creating and managing documents, spreadsheets, and presentations simple and efficient.
- 1. Visit the Official Site: Go to the official WPS Office website to download the free installer for your operating system.
- 2. Install the Software: Run the downloaded executable file and follow the quick installation prompts.
- 3. Open and Edit: Launch WPS Office and instantly open your existing Office files without losing any formatting.

Frequently Asked Questions
Why does my attachment name appear as null in Power Automate?
This commonly happens if the dynamic content mapped to the attachment name field is incorrect. When using the 'Get attachments' action, you should use the 'DisplayName' property instead of a generic name field which may return null.
How do I attach multiple files in the Send an email (V2) action?
To attach multiple files, you must initialize an array variable at the start of your flow. Then, use an 'Apply to each' loop to append a structured JSON object containing 'Name' and 'ContentBytes' for every attachment to that array. Finally, pass the array variable into the email action.
What is ContentBytes in a Power Automate attachment object?
The ContentBytes property represents the actual binary file content of your attachment. Simply providing a file name or path is not enough; you must use a 'Get file content' or 'Get attachment content' action to fetch this binary data and assign it to the ContentBytes property.




