web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / Copilot Studio Agent f...
Copilot Studio
Answered

Copilot Studio Agent failing to pass PDF attachment to Power Automate - Content Bytes Error

(2) ShareShare
ReportReport
Posted on by 17
 

Hi everyone,

I am building an automated reporting agent in Copilot Studio that is connected to a Power Automate flow. My goal is for a user to upload a PDF, have the flow extract data using an AI Builder prompt, update a SharePoint list, and send a formatted email.

The Workflow:

  1. Trigger: "When an agent calls the flow" (Input: File type named contentBytes).

  2. Logic: AI Builder extraction -> SharePoint "Update Item" -> Outlook Send Email.

  3. Frontend: Copilot Agent with the flow added as a Tool.

The Issues I am facing:

  1. TriggerInputSchemaMismatch: Even though the flow trigger is set to the "File" type, I consistently receive a BadRequest with the error code TriggerInputSchemaMismatch.

flowActionBadRequestThe flow 'Weekly Report Automator' ('bxx15a4-3xxd-fxxx1-002xxx30c9d6') failed to run with response code 'BadRequest', error code: TriggerInputSchemaMismatch.

  1. The "Content Bytes" Loop: When testing the agent, the AI fails to automatically grab the uploaded file. Instead, it responds with: "Please provide the content bytes of the PDF file you have uploaded."

  2. Power Fx Errors: I attempted to map the input in the Tools > Inputs tab using formulas like First(Activity.Attachments).contentBytes or Index(System.LastMessage.Attachments, 1), but the editor returns errors such as:

    • "Identifier not recognized: 'Activity' or 'Attachments'."

    • "The function 'First' has some invalid arguments."

  3. Naming Sync: I have tried renaming the flow and the input parameters (changing from MIR_Report_ to contentBytes) and re-adding the tool multiple times, but the agent still fails to pass the binary data of the file to the flow.

Questions: 

  1. All and all,  I am not able to connect my flow to my agent because of this schema mismatch in the files/attachments, so how can i solve it ?

  2. What is the "Gold Standard" way to map an attachment from a chat message to a Flow Action? Is there a specific Power Fx property we should be using (e.g., .ContentBytes, .FullName, or .OData_Type)?

  3. How can we prevent the 'TriggerInputSchemaMismatch'? It feels like the Agent UI and the Power Automate OpenAPI definition are out of sync regarding what constitutes a "File" object.

  4. What is the currently supported Power Fx syntax to extract the contentBytes from an attachment within the Agent Tools/Actions interface?                                        (I have attached screenshots of my Flow trigger, the Tool input mapping, and the System Error screen for reference.)

Screenshot 2026-03-18 181601.png
Screenshot 2026-03-18 181723.png
Screenshot 2026-03-18 181907.png
I have the same question (0)
  • Suggested answer
    chiaraalina Profile Picture
    1,955 Super User 2026 Season 1 on at
     
    Have you tried First(System.Activity.Attachments).Content?
     
    If that does not work: Did you originally create that input as a different data type (for example String) and then change it to File later?
     
  • Verified answer
    deepakmehta13a Profile Picture
    341 on at
    1. How to solve the schema mismatch issue
      Right now, the safest way is to avoid passing File type directly from the agent. Instead:

    • Change the flow input from File → Text (string) or pass a file reference (name/path/id)

    • Then inside the flow, use Get file content or reconstruct the file

    This avoids the TriggerInputSchemaMismatch completely.

    1. “Gold standard” way to pass attachments
      Currently, the most reliable pattern is:

    Agent → pass metadata (file name / id / link) → Flow retrieves file

    Direct binary (contentBytes) passing from agent → flow is not fully reliable yet.

    1. How to prevent TriggerInputSchemaMismatch
      This happens when the input schema in flow (File type) does not match what the agent actually sends.

    To prevent it:

    • Keep inputs as simple types (string, object)

    • Avoid File type unless the source strictly supports it

    • Re-add the flow after schema changes (important)

    1. Supported Power Fx for attachments
      As of now, expressions like:

    • First(System.Activity.Attachments)

    • System.LastMessage.Attachments

    are not supported in tool input mapping, which is why you’re seeing errors.

    There is currently no stable/supported Power Fx pattern to directly extract contentBytes from attachments in this interface.

    So in summary, nothing is wrong with your setup — this is a platform limitation + schema mismatch between agent and flow. Using a reference-based approach instead of direct file passing is the most stable solution today.

    Hope this helps.

    If this helps resolve your issue, please consider marking the response as Verified so it can help others facing a similar scenario.

    If you found this helpful, you can also click “Yes” on “Was this reply helpful?” or give it a Like.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Copilot Studio

#1
Valantis Profile Picture

Valantis 813

#2
Vish WR Profile Picture

Vish WR 313

#3
Haque Profile Picture

Haque 271

Last 30 days Overall leaderboard