Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Invalid number of parameters even though they're defined

(2) ShareShare
ReportReport
Posted on by 714 Super User 2025 Season 1
I inherited a small app and flow that I thought would be very easy to modify. The request was to add a order number field. Single line of text.
Added the column to the SP list, added a control to collect the data, modified the underlying flow to accept the text as a parameter.
 
Then I went to change the flow call and everything fell apart and I cannot figure out why.
 
I get an error saying I'm passing 7 parameters and it expects 5-6.
 
Here is the trigger definition in the flow:
FileName and FileContent are optional, all other fields are Required.
 
Here is the call from PowerApps:
 
    PeerFeedbackFlow.Run(
        EmployeeDataCardValue.Selected.Email,
        FeedbackDataCardValue.Selected.Value,
        DecriptionDataCardValue.Text,
        If(
            IsBlank(BusinessKCDataCardValue.Text),
            "N/A",
            (BusinessKCDataCardValue.Text)
        ),
        If(
            IsBlank(OrderNumberValue.Text),
            "N/A",
            (OrderNumberValue.Text)
        ),
        Last(AttachmentsDataCardValue17.Attachments).Name,
        {
            file: {
                name: Last(AttachmentsDataCardValue17.Attachments).Name,
                contentBytes: Last(AttachmentsDataCardValue17.Attachments).Value
                
            }
        }
    )
I cannot figure out what is wrong. I'm passing all the parameters in the same order that the flow seemingly expects them but the IDE in PowerApps tells me I'm passing 7 parameters and it expects 5-6.
 
  • Verified answer
    DCHammer Profile Picture
    714 Super User 2025 Season 1 on at
    Invalid number of parameters even though they're defined
    Just replying to my own post so I can mark this resolved.
    It's not really but closing out the post.
    It would appear there is a bug in the New Designer when creating a manually triggered flow and defining parameters.
    I'm not willing to rework this whole thing just to troubleshoot for MS. 
    I resolved my real problem in a different manner.
  • DCHammer Profile Picture
    714 Super User 2025 Season 1 on at
    Invalid number of parameters even though they're defined
    I was using the New Designer. I'll tackle this again at some point and take a shot at the old designer. I figured out an alternative solution to my problem for the time being. I have other cats to skin now.
  • abm abm Profile Picture
    32,488 Most Valuable Professional on at
    Invalid number of parameters even though they're defined
    Hi
     
    Are you using new designer flow? Switch to classic and save the flow. This might do the job. I have seen few issues when interface changes in the new one it doesn't reflect it automatically. 
     
    Thanks
  • DCHammer Profile Picture
    714 Super User 2025 Season 1 on at
    Invalid number of parameters even though they're defined
    FLMike, because all of the rest of the fields also have the checkbox in that position but the text says "Make the field Required". Have a look at the snips below.
     
    It's either just a bad design or a bug.
     
    I'm going to mark this as resolved regardless. I got sick of trying to figure it out and used FormSubmit to get the data into the list and created a Trigger based on list item creation to do the rest and it's working.
    Although some day I would like to figure this out because it's a reasonable use case.
     
    And for the record, the same error occurs regardless of what is indicated as required or not in the trigger.
     
  • Michael E. Gernaey Profile Picture
    43,442 Super User 2025 Season 1 on at
    Invalid number of parameters even though they're defined
    hi
     
    But in your picture it clearly has made it mandatory is Checked
     
    So why do you think its optional?
     
  • DCHammer Profile Picture
    714 Super User 2025 Season 1 on at
    Invalid number of parameters even though they're defined
    @bscarlavai33 The error actually happens in the call within the app. The OnSelect of the button results in a pink error bar at the top of the app which I missed capturing but the same error is then visible in the Editor which I did capture and share here:
     
  • bscarlavai33 Profile Picture
    608 Super User 2025 Season 1 on at
    Invalid number of parameters even though they're defined
    Can you take a screenshot of the flow error? Is something inside the flow expecting the FileContent?
  • DCHammer Profile Picture
    714 Super User 2025 Season 1 on at
    Invalid number of parameters even though they're defined
    So the problem is that even though I have the FileContent listed as Optional in the Trigger, the PA call to the flow fails unless I include it.
    I've handled this on the other fields with an If and populate with N/A if empty but I don't want to create fake attachments when they don't exist.
     
    So... why is PowerApps and PowerAutomate thinking I have to submit File Content?
     
    The actual method call is below. If I have an attachment in the attachments control, this works. If not, it fails and tells me that it is expecting two strings and is getting nulls. The two strings would be the file 'name' and 'contentBytes'. But they aren't defined as required in the trigger. 

    What am I doing wrong?
    PeerFeedbackFlow.Run(
            EmployeeDataCardValue.Selected.Email,
            FeedbackDataCardValue.Selected.Value,
            DecriptionDataCardValue.Text,
            If(
                IsBlank(BusinessKCDataCardValue.Text),
                "N/A",
                (BusinessKCDataCardValue.Text)
            ),
            If(
                IsBlank(OrderNumberValue.Text),
                "N/A",
                (OrderNumberValue.Text)
            ),
    //        Last(AttachmentsDataCardValue17.Attachments).Name,
            {
                file: {
                    name: Last(AttachmentsDataCardValue17.Attachments).Name,
                    contentBytes: Last(AttachmentsDataCardValue17.Attachments).Value
                    
                }
            }
        )

  • DCHammer Profile Picture
    714 Super User 2025 Season 1 on at
    Invalid number of parameters even though they're defined
    So I made some progress. I'm no longer getting an error about the number of parameters. I realized that the former dev added a specific filename parameter that is unnecessary. The filename is inside the file definition so I stripped it out.
    All parameters but the last are required.
     
    Flow call modified to this:
    PeerFeedbackFlow.Run(
            EmployeeDataCardValue.Selected.Email,
            FeedbackDataCardValue.Selected.Value,
            DecriptionDataCardValue.Text,
            If(
                IsBlank(BusinessKCDataCardValue.Text),
                "N/A",
                (BusinessKCDataCardValue.Text)
            ),
            If(
                IsBlank(OrderNumberValue.Text),
                "N/A",
                (OrderNumberValue.Text)
            ),
    //        Last(AttachmentsDataCardValue17.Attachments).Name,
            {
                file: {
                    name: Last(AttachmentsDataCardValue17.Attachments).Name,
                    contentBytes: Last(AttachmentsDataCardValue17.Attachments).Value
                    
                }
            }
        )
    You can see I just commented out the line that was sending the filename.
    This now throws a data mismatch error. It's expecting a string when it's getting a null.
    My test submission has no KCDataCardValue or OverNumberValue but the If's should be sending "N/A" through.
    So it appears, at least to me, that it is erroring because there is no attachment but that is not a required parameter in the flow.
  • Suggested answer
    bscarlavai33 Profile Picture
    608 Super User 2025 Season 1 on at
    Invalid number of parameters even though they're defined
    Try removing the Flow from the Canvas App and re-adding it. That should fix it.

    TEST: Can I actually modify someone else's reply?

    If yes, this didn't actually work. Deleting and re-adding the flow I mean.

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492