Skip to main content

Fixed: "The input parameter(s) of operation contains invalid expression(s)" in Power Automate

· 7 min read
Jagdish Kumawat
Founder @ Dewiride

Publishing my flow failed with The input parameter(s) of operation 'Ask_the_manager' contains invalid expression(s). The expression was one Power Automate had written for me, from a token I picked. The cause was an apostrophe in the name of the action it read from, Get the employee's manager. Renaming that action and picking the token again fixed it.

What I Was Doing​

I was building the approval flow of the Overtime Timesheet app. When the person who logged the overtime is their department's only approver, the flow asks their manager instead. In that branch, I added the Office 365 Users action Get manager (V2) and named it Get the employee's manager (How to Get a User's Manager in Power Automate).

Next came a Set variable action, Ask the manager, which puts the manager's email into the variable the approval goes to. For its Value, I picked the Mail token of Get the employee's manager from the dynamic content list:

The dynamic content list searched for Mail, with the Variables group showing ApproverEmails, then the group Get the employee's manager with Mail, outlined, and Nickname, then the group Get the department

Then I selected Publish.

What I Expected​

The flow to publish.

What I Got​

A red banner under the toolbar, and the flow stayed a draft:

The new designer's toolbar with Overtime Approval • Draft and a red banner, outlined, reading The input parameter(s) of operation 'Ask_the_manager' contains invalid expression(s). Fix invalid expression(s) for the input parameter(s) of operation 'Ask_the_manager'., with an Assist me button on the right

The full text:

The error
The input parameter(s) of operation 'Ask_the_manager' contains invalid expression(s). Fix invalid expression(s) for the input parameter(s) of operation 'Ask_the_manager'.

What I Checked​

  1. The action's Code view. I opened Ask the manager and selected Code view. The value the token had become was:

    Ask the manager → Code view (value)
    @outputs('Get_the_employee's_manager')?['body/mail']

    An expression names an action by its name with underscores for spaces, inside single quotes. Here the name has its own single quote, the apostrophe:

    The Code view of Ask the manager with the line value @outputs('Get_the_employee's_manager')?['body/mail'] outlined, and a runAfter line naming Get_the_employee's_manager, next to the canvas with the action Get the employee's manager outlined in the False branch of the condition Anyone left to approve?

  2. Microsoft's documentation. The Workflow Definition Language schema, the language of these expressions, says: To use a string literal as input or in expressions and functions, wrap the string only with single quotation marks. So 'Get_the_employee' is a complete string, and the s_manager' after it isn't valid. Neither the schema nor the functions reference says how to put a single quote inside a string.

  3. Renaming on its own. I renamed the action Get the manager. In Code view, the runAfter line followed the new name, but the Value kept the broken expression with the old name.

Why It Happens​

The designer writes the action's name into the expression between single quotes. An apostrophe in the name ends the quoted text early, so the expression can't be read. The name looks fine on the card; only the expression breaks.

The Fix​

  1. Rename the action without an apostrophe. Select its title on the card and type the new name; I used Get the manager. Action names in this flow use only letters and spaces.

  2. Pick the token again. In the action that reads it, here Ask the manager, remove the old Mail token and pick Mail from Get the manager again.

  3. Check Code view for the new name:

    Ask the manager → Code view (value), after the fix
    @outputs('Get_the_manager')?['body/mail']
  4. Publish.

After the Fix​

Code view showed the value reading Get_the_manager, and runAfter named the same action:

The Code view of Ask the manager with the value @outputs('Get_the_manager')?['body/mail'] and runAfter naming Get_the_manager, next to the canvas with the False branch now showing Get the manager and Ask the manager

The next Publish got past this action and stopped at a different name, the condition Anyone left to approve?, for its question mark: Fixed: "The provided workflow run action name has these invalid characters" (InvalidWorkflowRunActionName) in Power Automate. After renaming that too, the flow published, and its runs read the manager's email from Get the manager.

Common Mistakes​

MistakeWhat happensDo this instead
An apostrophe in an action's nameExpressions that read the action are invalidUse letters and spaces in action names
Renaming the action and stopping thereExisting tokens keep the broken expressionPick each token from the renamed action again
Only reading the cardThe name looks fineRead the reading action's Code view

Troubleshooting​

SymptomLikely causeFix
contains invalid expression(s) naming an actionAn expression in that action can't be readOpen its Code view
A quote in the middle of an outputs('...')An apostrophe in the source action's nameRename it, pick the token again
The error names a different action after the fixAnother name has a character it doesn't acceptRead the new message

FAQ​

Can I escape the apostrophe instead?​

Microsoft's expression documentation doesn't say how to put a single quote inside a string literal, so I didn't rely on one. Renaming the action needs no escaping, and the expressions stay easy to read.

Why does Power Automate let me use an apostrophe in a name?​

The name field accepted it, and saving a draft didn't complain. The problem appeared only when an expression had to quote the name and the flow was published.

Conclusion​

The input parameter(s) of operation contains invalid expression(s) named the action whose expression was broken, and Code view showed why: the source action's name, with its apostrophe, sat inside single quotes. Rename the source action without the apostrophe, pick the token again, and publish.

Additional Resources​