I was updating a flow earlier today, one that has been in production and running great with no issues for over a year, and when I went to save the changes, I got an awesome pink bar across the top.
"{"error":{"code":"InvalidOpenApiFlow","message":"Flow save failed with code 'ActionSchemaInvalid' and message 'The schema definition for action with status code '200' is not valid. The schema definitions for actions with the same status code must match.'."}}"
For context, my change involved adding a nested condition and going from two possible final paths, with Respond to a Power App or flow final steps, to four paths and possible responses.
What does this error mean?
Typically, it means you aren’t returning the same data from the flow back to the Power App (or other flow) if you have multiple Response steps. Meaning you can’t have one with response outputs of:
Status: "Failed"
ErrorCode: 404
And another branch with a response output of:
Status: "Succeeded"
You would need to add an ErrorCode output and value to the second case so that the schema matches the first one, like this:
Status: "Succeeded"
ErrorCode: null
Now your schema definitions are the same, generally speaking….
But it’s a Monday so
It can’t be that simple, right?
And it wasn’t. I was returning the exact same two outputs across all four branches but was still getting this error. Finally, I resorted to looking at the code behind each of these Response steps and this is where I found the problem. Spoiler - it was courtesy of Microsoft, not me!
Code View
Code view in Power Apps is a somewhat new thing, letting us peek behind the curtain a little bit and at least see our control customizations in the behind-the-scenes YAML format, but Code View has been around for longer in Power Automate.
In the classic designer, you would click in the ellipse in the top right corner of the action, and then select Peek Code.
But now in the modern designer, which is growing on me, it resides as a tab in the left-hand pane when you select the action.
The Root Cause
It turned out my schemas for these four Response steps were different, but not because of my Outputs or anything I did.
Remember how I said this flow had been running for over a year? Well, at some point during that year or so, Microsoft changed the default schema of the Respond step and so when I went to save my modified flow with two old Respond steps and two new Respond steps, it triggered this schema definitions mismatch error.
Take a look at these two screenshots below and you can see the highlighted differences.
See the added “hint” property in the new schema and the missing “metadata”? This was the cause of everything.
The fix is in
So, the fix was very simple, if not a little frustrating. I simply deleted and recreated the two old Respond steps, so they had the same new schema, and that was that.
Deleting and recreating steps or entire flows or other Power Platform objects is never fun but a lot of the time this is the behind-the-scenes kind of stuff that ultimately fixes the error.
Hopefully this will help someone else who may run into a similar issue.
Ed