Power automate debug
Debug failing Power Automate cloud flows using the FlowStudio MCP server. The Graph API only shows top-level status codes. This skill gives your agent action-level inputs and outputs to find the actual root cause. Load this skill when asked to: debug a flow, investigate a failed run, why is this flow failing, inspect action outputs, find the root cause of a flow error, fix a broken Power Automate flow, diagnose a timeout, trace a DynamicOperationRequestFailure, check connector auth errors, read error details from a run, or troubleshoot expression failures. Requires a FlowStudio MCP subscription — see https://mcp.flowstudio.app
By- name:
- power-automate-debug
- description:
- Debug failing Power Automate cloud flows using the FlowStudio MCP server. The Graph API only shows top-level status codes. This skill gives your agent action-level inputs and outputs to find the actual root cause. Load this skill when asked to: debug a flow, investigate a failed run, why is this flow failing, inspect action outputs, find the root cause of a flow error, fix a broken Power Automate flow, diagnose a timeout, trace a DynamicOperationRequestFailure, check connector auth errors, read error details from a run, or troubleshoot expression failures. Requires a FlowStudio MCP subscription — see https://mcp.flowstudio.app
Power Automate Debugging with FlowStudio MCP
A step-by-step diagnostic process for investigating failing Power Automate cloud flows through the FlowStudio MCP server.
Real debugging examples: Expression error in child flow | Data entry, not a flow bug | Null value crashes child flow
Prerequisite: A FlowStudio MCP server must be reachable with a valid API key or sign-in.
See the power-automate-mcp skill for connection setup.
Subscribe at https://mcp.flowstudio.app
Source of Truth
Always call
tool_searchfirst (skill:debug-flow, thenselect:each other tool used below; most sit in other bundles) to confirm tool names and parameter schemas. This skill covers response shapes, behavioral notes, and diagnostic patterns — things tool schemas cannot tell you. If this document disagrees withtool_searchor a real API response, the API wins.
Python Helper
import json, time, urllib.request
MCP_URL = "https://mcp.flowstudio.app/mcp"
MCP_TOKEN = "<YOUR_API_KEY>"
def mcp(tool, **kwargs):
payload = json.dumps({"jsonrpc": "2.0", "id": 1, "method": "tools/call",
"params": {"name": tool, "arguments": kwargs}}).encode()
req = urllib.request.Request(MCP_URL, data=payload,
headers={"x-api-key": MCP_TOKEN, "Content-Type": "application/json",
"User-Agent": "FlowStudio-MCP/1.0"})
try:
resp = urllib.request.urlopen(req, timeout=120)
except urllib.error.HTTPError as e:
body = e.read().decode("utf-8", errors="replace")
raise RuntimeError(f"MCP HTTP {e.code}: {body[:200]}") from e
raw = json.loads(resp.read())
if "error" in raw:
raise RuntimeError(f"MCP error: {json.dumps(raw['error'])}")
res = raw["result"]
if res.get("isError"): # refusals and failed calls: may not be JSON
raise RuntimeError(res["content"][0]["text"][:500])
return json.loads(res["content"][0]["text"])
ENV = "<environment-id>" # e.g. Default-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Step 1 — Locate the Flow
result = mcp("list_live_flows", environmentName=ENV, search="My Flow Name")
# Returns a wrapper object: {mode, flows, totalCount, error}
target = result["flows"][0]
FLOW_ID = target["id"] # plain UUID — use directly as flowName
print(FLOW_ID)
Step 2 — Find the Failing Run
res = mcp("get_live_flow_runs", environmentName=ENV, flowName=FLOW_ID,
status="Failed", top=5) # also startedAfter / startedBefore (date-times)
runs = res["runs"] # newest first, filtered by Power Automate across pages
# res: {"runs": [{"name": "08584296...CU15", "status": "Failed",
# "startTime": "...", "endTime": "...", "triggerName": "manual",
# "error": {"code": "ActionFailed", ...}}, ...],
# "runCount": 5, "runFilter": "status eq 'Failed'", "triggerChecks": null}
# NO RUNS != healthy. With no status or date filter, zero runs fills
# res["triggerChecks"]. byStatus: Skipped = polled, nothing new (not
# an error); Failed = trigger error: pass its checkId to outputs tool.
RUN_ID = runs[0]["name"] # runName="latest" also picks the newest run
Step 3 — Get the Top-Level Error
CRITICAL:
get_live_flow_run_errortells you which action failed.get_live_flow_run_action_outputstells you why. You must call BOTH. Never stop at the error alone — error codes likeActionFailed,NotSpecified, andInternalServerErrorare generic wrappers. The actual root cause (wrong field, null value, HTTP 500 body, stack trace) is only visible in the action's inputs and outputs.
err = mcp("get_live_flow_run_error",
environmentName=ENV, flowName=FLOW_ID, runName=RUN_ID)
# Returns:
# {
# "runName": "08584296068667933411438594643CU15",
# "failedActions": [
# {"actionName": "Apply_to_each_prepare_workers", "status": "Failed",
# "code": "ActionFailed", "error": {"code": "ActionFailed", ...},
# "startTime": "...", "endTime": "..."},
# {"actionName": "HTTP_find_AD_User_by_Name", "status": "Failed",
# "code": "NotSpecified", "startTime": "...", "endTime": "..."}
# ],
# "allActions": [
# {"actionName": "Apply_to_each", "status": "Skipped"},
# {"actionName": "Compose_WeekEnd", "status": "Succeeded"},
# ...
# ]
# }
# failedActions is in name order, not run order. Containers (Foreach, Scope,
# Condition) fail with ActionFailed; the ROOT is the entry that does not:
fa = err["failedActions"]
root = next((a for a in fa if a.get("code") != "ActionFailed"), fa[-1])
print(f"Root action: {root['actionName']} → code: {root.get('code')}")
# allActions shows every action's status — useful for spotting what was Skipped
# See common-errors.md to decode the error code.
Step 4 — Inspect the Failing Action's Inputs and Outputs
This is the most important step. The real error detail — HTTP status, response body, stack trace, null value — lives in the action's inputs and outputs.
# Get the root failing action's full inputs and outputs
root_action = root["actionName"]
detail = mcp("get_live_flow_run_action_outputs",
environmentName=ENV,
flowName=FLOW_ID,
runName=RUN_ID,
actionName=root_action)
reps = detail.get("actions") or detail.get("repetitions", [])
if len(reps) > 1:
print(f"{root_action} returned {len(reps)} repetitions; inspect iteration indexes")
out = reps[0] if reps else {}
print(f"Action: {out.get('actionName')}")
print(f"Status: {out.get('status')}")
# For HTTP actions, the real error is in outputs.body
if isinstance(out.get("outputs"), dict):
status_code = out["outputs"].get("statusCode")
body = out["outputs"].get("body", {})
print(f"HTTP {status_code}")
print(json.dumps(body, indent=2)[:500])
# Error bodies are often nested JSON strings — parse them
if isinstance(body, dict) and "error" in body:
err_detail = body["error"]
if isinstance(err_detail, str):
err_detail = json.loads(err_detail)
print(f"Error: {err_detail.get('message', err_detail)}")
# For expression errors, the error is in the error field
if out.get("error"):
print(f"Error: {out['error']}")
# Also check inputs — they show what expression/URL/body was used
if out.get("inputs"):
print(f"Inputs: {json.dumps(out['inputs'], indent=2)[:500]}")
What the action outputs reveal (that error codes don't)
Error code from get_live_flow_run_error |
What get_live_flow_run_action_outputs reveals |
|---|---|
ActionFailed |
Which nested action actually failed and its HTTP response |
NotSpecified |
The HTTP status code + response body with the real error |
InternalServerError |
The server's error message, stack trace, or API error JSON |
InvalidTemplate |
The exact expression that failed and the null/wrong-type value |
BadRequest |
The request body that was sent and why the server rejected it |
Foreach iterations
When actionName refers to an action inside a foreach, the output tool can
return every repetition of that action. Each item may include
repetitionIndexes with the loop name and zero-based itemIndex. Use
iterationIndex to inspect one iteration after you find the suspicious item:
all_reps = mcp("get_live_flow_run_action_outputs",
environmentName=ENV, flowName=FLOW_ID,
runName=RUN_ID,
actionName=root_action)
for rep in all_reps["repetitions"][:10]:
print(rep.get("repetitionIndexes"), rep.get("status"), rep.get("error"))
one_rep = mcp("get_live_flow_run_action_outputs",
environmentName=ENV,
flowName=FLOW_ID,
runName=RUN_ID,
actionName=root_action,
iterationIndex=3)
Evidence Compose Bookends
For uncertain connector work, add a Compose_*_Request before the risky action
and a Compose_*_Result after it, with the result action allowed on both
Succeeded and Failed. This gives future debugging a clean payload snapshot
without requiring another deploy. Do not include secrets or long binary payloads
in these bookends.
Example: HTTP action returning 500
Error code: "InternalServerError" ← this tells you nothing
Action outputs reveal:
HTTP 500
body: {"error": "Cannot read properties of undefined (reading 'toLowerCase')
at getClientParamsFromConnectionString (storage.js:20)"}
← THIS tells you the Azure Function crashed because a connection string is undefined
Example: Expression error on null
Error code: "BadRequest" ← generic
Action outputs reveal:
inputs: "body('HTTP_GetTokenFromStore')?['token']?['access_token']"
outputs: "" ← empty string, the path resolved to null
← THIS tells you the response shape changed — token is at body.access_token, not body.token.access_token
Step 5 — Read the Flow Definition
# summary: the action tree (name, type, runAfter, nesting), no inputs
tree = mcp("get_live_flow", environmentName=ENV, flowName=FLOW_ID, depth="summary")
print(tree["properties"]["definition"]["actionTree"])
# actions: just these, at any depth. Never save this back as a whole definition
defn = mcp("get_live_flow", environmentName=ENV, flowName=FLOW_ID, actions=[root_action])
# What changed since it last worked? A run name works as a version
# ("from" is a Python keyword, so pass it through **{})
ok = mcp("get_live_flow_runs", environmentName=ENV, flowName=FLOW_ID,
status="Succeeded", top=1)["runs"]
if ok:
print(mcp("diff_live_flow", environmentName=ENV, flowName=FLOW_ID,
**{"from": ok[0]["name"]})) # {added, removed, changed, triggers}
Inspect the failing action's inputs expression to see what data it expects.
Step 6 — Walk Back from the Failure
When the failing action's inputs reference upstream actions, inspect those too. Walk backward through the chain until you find the source of the bad data:
# No actionName: every action, any depth, one call; payloads capped at
# 4,000 chars ({truncated, preview}); the list is not in run order
survey = mcp("get_live_flow_run_action_outputs",
environmentName=ENV, flowName=FLOW_ID, runName=RUN_ID)
for out in sorted(survey["actions"], key=lambda a: a.get("startTime") or ""):
print(out["actionName"], out.get("status")) # names only: payloads can hold secrets
# Then read only the actions you suspect, with actionName (Step 4)
⚠️ A payload over 1 MB comes back as
{tooLarge, bytes, link, linkExpiresAt, note}instead of the data:linkdownloads it with a plain GET, no sign-in, until it expires. Inside a foreach, passiterationIndexto avoid every repetition.
Step 7 — Pinpoint the Root Cause
Expression Errors (e.g. split on null)
If the error mentions InvalidTemplate or a function name:
- Find the action in the definition
- Check what upstream action/expression it reads
- Inspect that upstream action's output for null / missing fields
# Example: action uses split(item()?['Name'], ' ')
# → null Name in the source data. A Compose's outputs IS the value;
# Select and Filter array put it in outputs.body
reps = mcp("get_live_flow_run_action_outputs", ..., actionName="Compose_Names")["actions"]
names = (reps[0].get("outputs") or []) if reps else []
nulls = [x for x in names if x.get("Name") is None]
print(f"{len(nulls)} records with null Name")
Wrong Field Path
Expression triggerBody()?['fieldName'] returns null → fieldName is wrong.
Inspect the trigger output to see the actual field names:
trig = mcp("get_live_flow_run_action_outputs", ..., trigger=True) # not actionName
print(json.dumps(trig.get("outputs"), indent=2)[:500])
HTTP Actions Returning Errors
The error code says InternalServerError or NotSpecified — always inspect
the action outputs to get the actual HTTP status and response body:
out = mcp("get_live_flow_run_action_outputs", ..., actionName="HTTP_Get_Data")["actions"][0]
print(f"HTTP {out['outputs']['statusCode']}")
print(json.dumps(out['outputs']['body'], indent=2)[:500])
Connection / Auth Failures
ConnectionAuthorizationFailed / InvalidConnectionCredentials: check it with
test_live_connection. create_live_connection with connectionName signs it in
again: give the person signInLink (you never sign in for them). Or bind a working
connection (list_live_connections search → template, then update_live_flow).
Outlook user-picker failures (DynamicListValuesUndefinedOrInvalid)
Outlook To/Cc/From/mailboxAddress pickers use AadGraph.GetUsers, which
Power Automate's own lookup refuses. resolve_live_parameters searches people the
way the designer does: pass search or match (a name or email). An email address
typed directly also works.
Step 8 — Apply the Fix
For expression/data issues:
# Surgical edit; inside a loop the path is ["actions", "<Loop>", "actions", ...]
ops = [{"op": "set", "path": ["actions", "Compose_Names", "inputs"],
"value": "@coalesce(item()?['Name'], 'Unknown')"}]
print(mcp("update_live_flow", environmentName=ENV, flowName=FLOW_ID,
operations=ops, dryRun=True)["changes"]) # preview, writes nothing
result = mcp("update_live_flow", environmentName=ENV, flowName=FLOW_ID, operations=ops)
# Still saving after 25 s → {taskId, status: "working", pollIntervalMs}.
# NEVER call update_live_flow again (duplicates) — poll get_task:
while result.get("status") == "working":
time.sleep(result["pollIntervalMs"] / 1000)
result = mcp("get_task", taskId=result["taskId"])
if "taskId" in result: # the save's own reply is in result
if result["status"] == "failed" or result.get("isError"):
raise RuntimeError(result.get("statusMessage") or result.get("result"))
result = result["result"]
print(result.get("error")) # None = success
⚠️ A refused save raises (
isError). If an unpublished portal draft blocks it (XrmApiServerError), it may hold someone else's work: ask the person to publish it, or to approvediscardDraft=True.
Step 9 — Verify the Fix
Use
resubmit_live_flow_runto test ANY flow. It replays a past run with its original trigger payload — Recurrence, SharePoint, connector webhooks, Button and HTTP alike — so there is no wait for the next real event. It cannot help a brand-new flow that has never run.
# Resubmit the failed run — works for ANY trigger type
resubmit = mcp("resubmit_live_flow_run",
environmentName=ENV, flowName=FLOW_ID, runName=RUN_ID)
print(resubmit) # {"resubmitted": true, "triggerName": "..."}
# Wait ~30 s then check
time.sleep(30)
new_runs = mcp("get_live_flow_runs", environmentName=ENV, flowName=FLOW_ID, top=3)["runs"]
print(new_runs[0]["status"]) # Succeeded = done
When to use resubmit vs trigger
| Scenario | Use | Why |
|---|---|---|
| Testing a fix on any flow | resubmit_live_flow_run |
Replays the exact trigger payload that caused the failure — best way to verify |
| Recurrence / scheduled flow | trigger_live_flow (no body) |
Runs it now, like the portal's "Run flow" button; resubmit replays a past run's data |
| SharePoint / connector trigger | resubmit_live_flow_run |
Cannot be triggered without creating a real SP item |
| HTTP, Button, PowerApps or Skills trigger, custom payload | trigger_live_flow |
When you need to send different data than the original run |
| Brand-new Request or Recurrence flow | trigger_live_flow |
No prior run to resubmit |
Testing HTTP, Button, PowerApps and Skills flows with custom payloads
For flows with a Request trigger (HTTP request, manual Button, PowerApps or Skills),
use trigger_live_flow when you need to send a different payload than the
original run. Pass trigger inputs as body for every kind:
# First inspect what the trigger expects (summary keeps triggers whole)
defn = mcp("get_live_flow", environmentName=ENV, flowName=FLOW_ID, depth="summary")
manual = next(iter(defn["properties"]["definition"]["triggers"].values()))
print("Expected body schema:", manual.get("inputs", {}).get("schema"))
# Trigger with a test payload
result = mcp("trigger_live_flow",
environmentName=ENV,
flowName=FLOW_ID,
body={"name": "Test User", "value": 42})
print(f"Status: {result['responseStatus']}, Body: {result.get('responseBody')}")
print(f"Kind: {result['triggerKind']}, via: {result['invocation']}, run: {result.get('runName')}")
if result.get("warning"):
print(result["warning"]) # required trigger inputs you left out
trigger_live_flowhandles AAD-authenticated triggers. A scheduled flow runs now with nobody(a body is refused); automated connector triggers only fire from their source event.Power Automate does not enforce a trigger's
requiredinputs. If you leave one out the run still starts, with that input null, and the result carries awarningnaming the missing keys. Cancel the run and call again with the full body if that matters.
runNamecomes back only when abodywent through the connector runtime (Button, PowerApps, Skills). Otherwise find the run withget_live_flow_runs.A browser-extension key sends inputs too, through the extension (1.0.19 or later).
Quick-Reference Diagnostic Decision Tree
| Symptom | First Tool | Then ALWAYS Call | What to Look For |
|---|---|---|---|
| Flow shows as Failed | get_live_flow_run_error |
get_live_flow_run_action_outputs on the failing action |
HTTP status + response body in outputs |
Error code is generic (ActionFailed, NotSpecified) |
— | get_live_flow_run_action_outputs |
The outputs.body contains the real error message, stack trace, or API error |
| HTTP action returns 500 | — | get_live_flow_run_action_outputs |
outputs.statusCode + outputs.body with server error detail |
| Expression crash | — | get_live_flow_run_action_outputs on prior action |
null / wrong-type fields in output body |
| Flow never starts | get_live_flow (state) |
get_live_flow_runs, no filter |
Failed in byStatus; Skipped is normal |
| Worked before, fails now | get_live_flow_versions |
diff_live_flow |
actions added, removed or changed |
| Action returns wrong data | get_live_flow_run_action_outputs |
— | actual output body vs expected |
| Fix applied but still fails | get_live_flow_runs after resubmit |
— | new run status field |
Reference Files
- common-errors.md — Error codes, likely causes, and fixes
- debug-workflow.md — Full decision tree for complex failures
Related Skills
power-automate-mcp— Foundation skill: connection setup, MCP helper, tool discoverypower-automate-build— Build and deploy new flows
Open this reference as its own page
FlowStudio MCP — Common Power Automate Errors
Reference for error codes, likely causes, and recommended fixes when debugging Power Automate flows via the FlowStudio MCP server.
Expression / Template Errors
InvalidTemplate — Function Applied to Null
Full message pattern: "Unable to process template language expressions... function 'split' expects its first argument 'text' to be of type string"
Root cause: An expression like @split(item()?['Name'], ' ') received a null value.
Diagnosis:
- Note the action name in the error message
- Call
get_live_flow_run_action_outputson the action that produces the array - Find items where
Name(or the referenced field) isnull
Fixes:
Before: @split(item()?['Name'], ' ')
After: @split(coalesce(item()?['Name'], ''), ' ')
Or guard the whole foreach body with a condition:
expression: "@not(empty(item()?['Name']))"
InvalidTemplate — Wrong Expression Path
Full message pattern: "Unable to process template language expressions... 'triggerBody()?['FieldName']' is of type 'Null'"
Root cause: The field name in the expression doesn't match the actual payload schema.
Diagnosis:
# Check trigger output shape (trigger=True, not actionName="<trigger-name>")
trig = mcp("get_live_flow_run_action_outputs",
environmentName=ENV, flowName=FLOW_ID, runName=RUN_ID,
trigger=True)
print(trig["outputs"]["body"]) # compare actual keys vs expression
Fix: Update expression to use the correct key name. Common mismatches:
triggerBody()?['body']vstriggerBody()?['Body'](case-sensitive)triggerBody()?['Subject']vstriggerOutputs()?['body/Subject']
InvalidTemplate — Type Mismatch
Full message pattern: "... expected type 'Array' but got type 'Object'"
Root cause: Passing an object where the expression expects an array (e.g. a single item HTTP response vs a list response).
Fix:
Before: @outputs('HTTP')?['body']
After: @outputs('HTTP')?['body/value'] ← for OData list responses
@createArray(outputs('HTTP')?['body']) ← wrap single object in array
WorkflowOperationParametersRuntimeMissingValue — Required Parameter Is Null
Full message pattern: "The 'inputs.parameters' of workflow operation 'Get_manager' ... may not be null or empty: 'id'"
Root cause: An expression feeding a required connector parameter resolved to null or empty at run time — often a trigger field the item did not have.
Diagnosis: get_live_flow_run_action_outputs with the action name shows the
resolved inputs.parameters; read the trigger with trigger: true.
Fix: Guard the value — coalesce(...), or a Condition that skips the action
when it is empty.
Connection / Auth Errors
ConnectionAuthorizationFailed
Full message: "The API connection ... is not authorized."
Root cause: The connection referenced in the flow belongs to a different user than the one the flow runs as, or is not shared with them.
Diagnosis: get_live_flow → properties.connectionReferences gives the
connectionName. list_live_connections with search shows its owner
(createdBy) and statuses; test_live_connection checks it.
Fix options:
- Bind a connection the run identity owns:
list_live_connectionswithsearchreturns a paste-readyconnectionReferenceTemplateandhostTemplate; save them withupdate_live_flow(connectionReferencescan go withoperationsin the same save) - No suitable connection:
create_live_connection(connectorName) creates one; the person signs in from the card orsignInLink— you never sign in for them - Share the connection with the run identity in Power Automate
InvalidConnectionCredentials
Root cause: The underlying OAuth token for the connection has expired or the user's credentials changed.
Fix: test_live_connection confirms it. create_live_connection with
connectorName and connectionName signs that connection in again: give its
owner signInLink (it expires about 10 minutes after it is made). Then
test_live_connection again and resubmit the failed run. Connectors that use a
key or account details are refused: renew those in Power Automate.
"This needs one more sign-in"
Symptom: A connector call (test_live_connection, read_live_table, or a
resolve_live_parameters people search) answers "This needs one more sign-in".
Fix: Call grant_flow_studio_access (no arguments). The person grants access
from its card, then retry. Nothing for an admin to change.
HTTP Action Errors
ActionFailed — HTTP 4xx/5xx
Full message pattern: "An HTTP request to... failed with status code '400'"
Diagnosis:
actions_out = mcp("get_live_flow_run_action_outputs", ..., actionName="HTTP_My_Call")
item = actions_out["actions"][0] # outside a loop; inside one the key is "repetitions"
print(item["outputs"]["statusCode"]) # 400, 401, 403, 500...
print(item["outputs"]["body"]) # error details from target API
Common causes:
- 401 — missing or expired auth header
- 403 — permission denied on target resource
- 404 — wrong URL / resource deleted
- 400 — malformed JSON body (check expression that builds the body)
ActionFailed — HTTP Timeout
Root cause: Target endpoint did not respond within Power Automate's limit (120 seconds for a synchronous outbound request; an asynchronous pattern can run up to 30 days).
Fix: Add retry policy to the HTTP action, or split the payload into smaller batches to reduce per-request processing time.
Control Flow Errors
ActionSkipped Instead of Running
Root cause: The runAfter condition wasn't met. E.g. an action set to
runAfter: { "Prev": ["Succeeded"] } won't run if Prev failed or was skipped.
Diagnosis: Check the preceding action's status. Deliberately skipped (e.g. inside a false branch) is intentional — unexpected skip is a logic gap.
Fix: Add "Failed" or "Skipped" to the runAfter status array if the
action should run on those outcomes too.
Foreach Runs in Wrong Order / Race Condition
Root cause: Foreach without operationOptions: "Sequential" runs
iterations in parallel, causing write conflicts or undefined ordering.
Fix: Add "operationOptions": "Sequential" to the Foreach action.
Foreach Parent Failed After Handled Inner Failure
Symptom: Inner actions have failure handlers, but the parent Foreach still
shows Failed, and downstream actions such as Response are skipped.
Root cause: A handled child failure can still mark the loop container as
failed. Downstream runAfter that only accepts Succeeded will not run.
Diagnosis: Inspect the parent foreach with get_live_flow_run_error, then
inspect child action outputs for the iteration that failed.
Fix: If partial success is acceptable, allow the downstream join/response to
run after Succeeded and Failed, and include an explicit error summary in the
payload. If the loop must be all-or-nothing, wrap risky inner work in a Scope and
handle success/failure at the Scope boundary.
Update / Deploy Errors
update_live_flow Returns No-Op
Symptom: The flow does not change: result["updated"] does not list
definition, or the save is refused. (created is a boolean: true only when a
new flow was made.)
Likely cause: Passing wrong parameter name. The key is definition (object)
or operations (list), not flowDefinition or body. Preview first with
dryRun: true — its wouldUpdate (and, with operations, changes) shows what would be saved.
update_live_flow — "no connectionReferences were provided"
Root cause: The definition contains OpenApiConnection or
OpenApiConnectionWebhook actions but connectionReferences was not passed, and
there were none to reuse. On an update the server reuses the flow's stored map
when you leave it out, so this is mostly a create.
Fix: Pass connectionReferences — from get_live_flow for an existing flow,
or list_live_connections with search (connectionReferenceTemplate) for a new one.
update_live_flow — Unpublished Draft Blocks the Save
Symptom: A solution flow's save fails with XrmApiServerError ("there exists
an unpublished active row"). The reply says a draft in the maker portal is locking it.
Fix: The draft may hold someone else's unpublished work, so ask the person
first: publish it in the portal, or approve discarding it. To discard, call
update_live_flow again with discardDraft: true. The draft is not lost: it
stays in the flow's version history (get_live_flow_versions).
update_live_flow — Flow Changed Since You Read It
Symptom: "Not written: the flow changed since you read it".
Root cause: You passed expectedLastModifiedTime (from get_live_flow's
properties.lastModifiedTime) and someone saved the flow after your read. Pass it
on every whole-definition save so you never overwrite another change.
Fix: Read the flow again with get_live_flow, reapply your change, and pass the
new lastModifiedTime.
update_live_flow Replies With a taskId
Symptom: {taskId, status: "working", pollIntervalMs} instead of a result. The
save took over 25 seconds and is still running on the server.
Fix: Do NOT call update_live_flow again — that is how duplicate flows happen.
Wait pollIntervalMs, then call get_task with the taskId until status
is completed (result holds the save's own reply) or failed.
Data Logic Errors
union() Overriding Correct Records with Nulls
Symptom: After merging two arrays, some records have null fields that existed in one of the source arrays.
Root cause: union(old_data, new_data) — union() first-wins, so old_data
values override new_data for matching records.
Fix: Swap argument order: union(new_data, old_data)
Before: @sort(union(outputs('Old_Array'), body('New_Array')), 'Date')
After: @sort(union(body('New_Array'), outputs('Old_Array')), 'Date')
Null Cascade in Filter Array / Query
Symptom: A lookup/filter step returns the wrong record or a later expression fails on null even though the filter action itself succeeded.
Root cause: The lookup key is null or empty. A condition such as
equals(item()?['Email'], outputs('Lookup_Email')) can accidentally match rows
where both sides are null, or can pass an empty array downstream.
Diagnosis: Inspect the action that creates the lookup key and the filter output length. Confirm the key is non-empty before trusting the filter result.
Fix: Add a non-empty guard before the filter, normalize comparison values
with trim()/toLower(), and branch explicitly when no match is found.
Open this reference as its own page
FlowStudio MCP — Debug Workflow
End-to-end decision tree for diagnosing Power Automate flow failures.
Top-Level Decision Tree
Flow is failing
│
├── Flow never starts / no runs appear
│ └── ► Check flow State: get_live_flow → properties.state
│ ├── "Stopped" → someone turned it off (flowSuspensionReason "None"),
│ │ maybe on purpose. Ask the person, then turn it on with
│ │ set_live_flow_state (state "Started")
│ ├── "Suspended" → Power Automate turned it off. flowSuspensionReason and
│ │ flowSuspensionReasonDetails say why (e.g. "AlwaysFailingDetected":
│ │ failed for 14 days). Fix that cause first and ask the person, then set_live_flow_state
│ │ (state "Started"). Not yet tried on a suspended flow: check the
│ │ reply's currentState, and tell the person if it is not "Started"
│ └── "Started" + no runs → get_live_flow_runs with NO status/date filter
│ → triggerChecks (newest 40 checks of the first trigger)
│ ├── Failed → the trigger errors: recent[].failure has the message
│ │ for the newest 3; for others, get_live_flow_run_action_outputs
│ │ with that checkId
│ ├── only Skipped → it polled and found nothing new, or a trigger
│ │ condition filtered it out. Not a fault: check the source data
│ │ and the trigger conditions
│ ├── checked 0 → no checks recorded (Request/Button trigger never
│ │ called)
│ └── available false → checks unreadable (reason, e.g. owner access);
│ says nothing about health
│
├── Flow run shows "Failed"
│ ├── Step A: get_live_flow_run_error → read failedActions[].code (+ error.message when present)
│ │
│ ├── error.code = "InvalidTemplate"
│ │ └── ► Expression error (null value, wrong type, bad path)
│ │ └── See: Expression Error Workflow below
│ │
│ ├── error.code = "ConnectionAuthorizationFailed" / "InvalidConnectionCredentials"
│ │ └── ► test_live_connection; sign it in again with create_live_connection
│ │ (connectionName), or bind a working connection with update_live_flow
│ │
│ ├── error.code = "ActionFailed" + message mentions HTTP
│ │ └── ► See: HTTP Action Workflow below
│ │
│ ├── parent action is Foreach / Apply to each
│ │ └── ► Inspect child actions; handled child failures can still fail the parent
│ │
│ └── Unknown / generic error
│ └── ► Walk actions backwards (Step B below)
│
├── Flow worked before, fails now
│ └── ► diff_live_flow from the last Succeeded run's name (a run works as a
│ version) → actions added, removed, changed; get_live_flow_versions lists them
│
└── Flow Succeeds but output is wrong
└── ► Inspect intermediate actions with get_live_flow_run_action_outputs
└── See: Data Quality Workflow below
Expression Error Workflow
InvalidTemplate error
│
├── 1. Read error.message — identifies the action name and function
│
├── 2. Get flow definition: get_live_flow
│ └── Find that action in definition["actions"][action_name]["inputs"]
│ └── Identify what upstream value the expression reads
│
├── 3. get_live_flow_run_action_outputs for the action BEFORE the failing one
│ └── Look for null / wrong type in that action's output
│ ├── Null string field → wrap with coalesce(): @coalesce(field, '')
│ ├── Null object → add empty check condition before the action
│ └── Wrong field name → correct the key (case-sensitive)
│
└── 4. Apply fix with update_live_flow, then resubmit
HTTP Action Workflow
ActionFailed on HTTP action
│
├── 1. get_live_flow_run_action_outputs on the HTTP action
│ └── Read: outputs.statusCode, outputs.body
│
├── statusCode = 401
│ └── ► Auth header missing or expired OAuth token
│ Check: action inputs.authentication block
│
├── statusCode = 403
│ └── ► Insufficient permission on target resource
│ Check: service principal / user has access
│
├── statusCode = 400
│ └── ► Malformed request body
│ Check: action inputs.body expression; parse errors often in nested JSON
│
├── statusCode = 404
│ └── ► Wrong URL or resource deleted/renamed
│ Check: action inputs.uri expression
│
└── statusCode = 500 / timeout
└── ► Target system error; retry policy may help
Add: "retryPolicy": {"type": "Fixed", "count": 3, "interval": "PT10S"}
Data Quality Workflow
Flow succeeds but output data is wrong
│
├── 1. Identify the first "wrong" output — which action produces it?
│
├── 2. get_live_flow_run_action_outputs on that action
│ └── Compare actual output body vs expected
│
├── Source array has nulls / unexpected values
│ ├── Check the trigger data — get_live_flow_run_action_outputs with trigger: true
│ ├── Check the source rows — read_live_table (Dataverse table, SharePoint list,
│ │ SQL or Excel table; select + filter, top 1 to 100) shows if the data itself is bad
│ └── Trace forward action by action until the value corrupts
│
├── Merge/union has wrong values
│ └── Check union argument order:
│ union(NEW, old) = new wins ✓
│ union(OLD, new) = old wins ← common bug
│
├── Foreach output missing items
│ ├── Check foreach condition — filter may be too strict
│ └── Check if parallel foreach caused race condition (add Sequential)
│
├── Filter/Query result unexpectedly matches nulls or returns empty
│ └── Guard lookup keys before the filter; do not compare null-to-null
│
└── Date/time values wrong timezone
└── Use convertTimeZone() — utcNow() is always UTC
Walk-Back Analysis (Unknown Failure)
When the error message doesn't clearly name a root cause:
# 1. One call: every action (nested ones too) with status, startTime and capped payloads
survey = mcp("get_live_flow_run_action_outputs",
environmentName=ENV, flowName=FLOW_ID, runName=RUN_ID)
# Returns {runName, actions: [...]}. The list is NOT in run order, so sort it
for item in sorted(survey["actions"], key=lambda a: a.get("startTime") or ""):
print(f"{item['actionName']}: {item.get('status', 'unknown')}")
# 2. Find the boundary between Succeeded and Failed/Skipped
# The first Failed action is likely the root cause (unless skipped by design)
This lists nested actions too, one record each. For every iteration of an action
inside a Foreach, pass its actionName (the reply's key is then repetitions) — and
check the parent first to confirm the branch ran at all.
Post-Fix Verification Checklist
update_live_flowreturnserror: null— definition accepted. AtaskIdreply means it is still saving: pollget_task, never callupdate_live_flowagainresubmit_live_flow_runconfirms new run started (ortrigger_live_flow: for a flow whose connections come from whoever runs it,runOnlyUserConnectionssays which connection the run used, andconnectionspicks another)- Wait for run completion (poll
get_live_flow_runsevery 15 s) - Confirm new run
status = "Succeeded" - If flow has downstream consumers (child flows, emails, SharePoint writes), spot-check those too
More in this playbook
Cross crm opportunity sync
Coordinate opportunities and customer records across multiple CRMs while preserving attribution, visibility, commissions, and governance.
IntegrationsMIT Wade Foster + 1Co-founder & CEO @ ZapierInstall zapier
Install and connect Zapier, routing to the right surface (MCP, SDK, or CLI) for what the person needs. Use when someone says "install Zapier", "add Zapier", "connect Zapier", or "set up Zapier", or when they want an AI client (Claude, ChatGPT, Cursor) to use their apps, want to call Zapier from code, or want Zapier in the terminal.
IntegrationsMIT Wade Foster + 1Co-founder & CEO @ ZapierMcp sheet cache bridge
Keep Zapier Tables or another MCP-connected record store as the source of truth while Google Sheets-based tools read an event-driven cache tab.
