Invalid file format – Unsupported file format passed to a flow action

Loading

Power Automate allows users to process files from various sources, such as SharePoint, OneDrive, Dataverse, Azure Blob Storage, and external APIs. However, sometimes a flow fails due to an unsupported file format, leading to errors such as:

“Invalid file format: The specified file type is not supported for this action.”

This guide explains:
Why the “Invalid File Format” error occurs.
How to diagnose the issue.
How to fix common file format problems.


Step 1: Understanding Common Causes of the “Invalid File Format” Error

CauseDescription
Unsupported file formatThe action does not support the file type being used.
Missing file extensionSome flow actions require a proper file extension.
Mismatched content typeThe file’s actual format does not match its extension.
Corrupted fileThe file may be damaged and unreadable.
Incorrect MIME typeSome connectors validate file formats based on MIME types.
Encoded file issue (Base64, binary, etc.)The file format needs to be decoded before processing.

Step 2: Diagnosing the Issue

2.1. Check the Flow Run History

  1. Open Power Automate (https://make.powerautomate.com).
  2. Click on My Flows → Select the affected flow.
  3. Go to Run History → Open a failed run.
  4. Look for an error message like: Invalid file format: The specified file type is not supported.
  5. Expand the action details to check:
    • File extension used in the flow.
    • Content type (MIME type) detected by Power Automate.
    • Error details from API responses.

Step 3: Fixing Common “Invalid File Format” Errors

3.1. Fix Unsupported File Formats

Problem: The flow action does not support the file format being used.

Solution:

  • Check if the action supports the file type. For example:
    • “Convert file to PDF” only supports .docx, .xlsx, and .pptx.
    • AI Builder “Extract Text” does not work with .zip or .rar files.
    • “Create File in SharePoint” does not support .exe or .bat files.

Example: Convert an Unsupported File Type to a Supported Format

If the action does not support .png, but supports .jpg:

  1. Add a “Convert File” action (if available).
  2. Convert .png to .jpg before passing it to the next step.

3.2. Fix Missing or Incorrect File Extensions

Problem: Some file actions require a proper extension (e.g., .pdf, .xlsx).

Solution:

  • Ensure the file has the correct extension before processing.
  • If missing, append the correct extension dynamically:
concat(triggerOutputs()?['body/FileName'], '.pdf')
  • If the extension is incorrect, rename the file with the correct format before processing.

3.3. Fix Mismatched Content Type Issues

Problem: The file’s actual format does not match its extension (e.g., a renamed .txt file pretending to be .xlsx).

Solution:

  • Check the MIME type returned in the failed flow.
  • Use the “Get file content” action and inspect the file header to verify the actual type.
  • Convert or re-save the file in the correct format before processing.

Example: Validate MIME Type Before Proceeding

If "MIME Type" is not "application/pdf", send an error alert.

3.4. Fix Corrupted Files

Problem: The file is corrupted or unreadable.

Solution:

  • Try opening the file manually in Notepad, Excel, or Adobe Acrobat.
  • If the file is corrupted, re-upload a working version.
  • If the file is being downloaded via API, ensure the request is correct.

3.5. Fix Incorrect MIME Type Issues

Problem: Some Power Automate actions rely on MIME type validation instead of file extensions.

Solution:

  • Ensure that the MIME type is correct before processing.
  • If the MIME type is incorrect, set the expected type manually.

Example: Manually Correct MIME Type in HTTP Requests

Headers:
{
"Content-Type": "application/pdf"
}

3.6. Fix Encoded File Issues (Base64, Binary, etc.)

Problem: Some flows require files in binary format, while others expect Base64 encoding.

Solution:

  • If a file is Base64-encoded, decode it before processing using the “Base64 to Binary” action.
  • If an API requires Base64, encode the file before sending it:
base64(fileContent)

Step 4: Preventing Future “Invalid File Format” Errors

4.1. Best Practices to Avoid File Format Issues

Use supported file types for each action.
Ensure files have the correct extensions.
Validate MIME types before processing files.
Check if a file is corrupted before running the flow.
Convert unsupported file formats before using them in the flow.
Ensure proper encoding (Base64 or binary) based on API requirements.


Step 5: Set Up Alerts for Invalid File Formats

  1. Open Power AutomateMy Flows.
  2. Click Edit Flow → Add a “Send an email” action if the file format is invalid.
  3. Configure the email to alert users about unsupported files.

Leave a Reply

Your email address will not be published. Required fields are marked *