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...
---
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
metadata:
openclaw:
requires:
env:
- FLOWSTUDIO_MCP_TOKEN
primaryEnv: FLOWSTUDIO_MCP_TOKEN
homepage: 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](https://github.com/ninihen1/power-automate-mcp-skills/blob/main/examples/fix-expression-error.md) |
> [Data entry, not a flow bug](https://github.com/ninihen1/power-automate-mcp-skills/blob/main/examples/data-not-flow.md) |
> [Null value crashes child flow](https://github.com/ninihen1/power-automate-mcp-skills/blob/main/examples/null-child-flow.md)
**Prerequisite**: A FlowStudio MCP server must be reachable with a valid JWT.
See the `power-automate-mcp` skill for connection setup.
Subscribe at https://mcp.flowstudio.app
---
## Source of Truth
> **Always call `tools/list` first** to confirm available tool names and their
> parameter schemas. Tool names and parameters may change between server versions.
> This skill covers response shapes, behavioral notes, and diagnostic patterns —
> things `tools/list` cannot tell you. If this document disagrees with `tools/list`
> or a real API response, the API wins.
---
## Python Helper
```python
import json, urllib.request
MCP_URL = "https://mcp.flowstudio.app/mcp"
MCP_TOKEN = "<YOUR_JWT_TOKEN>"
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'])}")
return json.loads(raw["result"]["content"][0]["text"])
ENV = "<environment-id>" # e.g. Default-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
```
---
## Step 1 — Locate the Flow
```python
result = mcp("list_live_flows", environmentName=ENV)
# Returns a wrapper object: {mode, flows, totalCount, error}
target = next(f for f in result["flows"] if "My Flow Name" in f["displayName"])
FLOW_ID = target["id"] # plain UUID — use directly as flowName
print(FLOW_ID)
```
---
## Step 2 — Find the Failing Run
```python
runs = mcp("get_live_flow_runs", environmentName=ENV, flowName=FLOW_ID, top=5)
# Returns direct array (newest first):
# [{"name": "08584296068667933411438594643CU15",
# "status": "Failed",
# "startTime": "2026-02-25T06:13:38.6910688Z",
# "endTime": "2026-02-25T06:15:24.1995008Z",
# "triggerName": "manual",
# "error": {"code": "ActionFailed", "message": "An action failed..."}},
# {"name": "...", "status": "Succeeded", "error": null, ...}]
for r in runs:
print(r["name"], r["status"], r["startTime"])
RUN_ID = next(r["name"] for r in runs if r["status"] == "Failed")
```
---
## Step 3 — Get the Top-Level Error
> **CRITICAL**: `get_live_flow_run_error` tells you **which** action failed.
> `get_live_flow_run_action_outputs` tells you **why**. You must call BOTH.
> Never stop at the error alone — error codes like `ActionFailed`,
> `NotSpecified`, and `InternalServerError` are 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.
```python
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",
# "error": {"code": "ActionFailed", "message": "An action failed..."},
# "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 ordered outer-to-inner. The ROOT cause is the LAST entry:
root = err["failedActions"][-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.** `get_live_flow_run_error` only gives
> you a generic error code. The actual error detail — HTTP status codes,
> response bodies, stack traces, null values — lives in the action's runtime
> inputs and outputs. **Always inspect the failing action immediately after
> identifying it.**
```python
# Get the root failing action's full inputs and outputs
root_action = err["failedActions"][-1]["actionName"]
detail = mcp("get_live_flow_run_action_outputs",
environmentName=ENV,
flowName=FLOW_ID,
runName=RUN_ID,
actionName=root_action)
out = detail[0] if detail 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 |
### 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
```python
defn = mcp("get_live_flow", environmentName=ENV, flowName=FLOW_ID)
actions = defn["properties"]["definition"]["actions"]
print(list(actions.keys()))
```
Find the failing action in the definition. Inspect its `inputs` expression
to understand 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:
```python
# Inspect multiple actions leading up to the failure
for action_name in [root_action, "Compose_WeekEnd", "HTTP_Get_Data"]:
result = mcp("get_live_flow_run_action_outputs",
environmentName=ENV,
flowName=FLOW_ID,
runName=RUN_ID,
actionName=action_name)
out = result[0] if result else {}
print(f"\n--- {action_name} ({out.get('status')}) ---")
print(f"Inputs: {json.dumps(out.get('inputs', ''), indent=2)[:300]}")
print(f"Outputs: {json.dumps(out.get('outputs', ''), indent=2)[:300]}")
```
> ⚠️ Output payloads from array-processing actions can be very large.
> Always slice (e.g. `[:500]`) before printing.
> **Tip**: Omit `actionName` to get ALL actions in a single call.
> This returns every action's inputs/outputs — useful when you're not sure
> which upstream action produced the bad data. But use 120s+ timeout as
> the response can be very large.
---
## Step 7 — Pinpoint the Root Cause
### Expression Errors (e.g. `split` on null)
If the error mentions `InvalidTemplate` or a function name:
1. Find the action in the definition
2. Check what upstream action/expression it reads
3. **Inspect that upstream action's output** for null / missing fields
```python
# Example: action uses split(item()?['Name'], ' ')
# → null Name in the source data
result = mcp("get_live_flow_run_action_outputs", ..., actionName="Compose_Names")
if not result:
print("No outputs returned for Compose_Names")
names = []
else:
names = result[0].get("outputs", {}).get("body") or []
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:
```python
result = mcp("get_live_flow_run_action_outputs", ..., actionName="<trigger-action-name>")
print(json.dumps(result[0].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:
```python
result = mcp("get_live_flow_run_action_outputs", ..., actionName="HTTP_Get_Data")
out = result[0]
print(f"HTTP {out['outputs']['statusCode']}")
print(json.dumps(out['outputs']['body'], indent=2)[:500])
```
### Connection / Auth Failures
Look for `ConnectionAuthorizationFailed` — the connection owner must match the
service account running the flow. Cannot fix via API; fix in PA designer.
### Outlook user-picker failures (`DynamicListValuesUndefinedOrInvalid`)
Outlook actions like `GetEmailsV3` use parameters (`mailboxAddress`, `to`, `cc`,
`from`) whose dropdown is backed by `builtInOperation:AadGraph.GetUsers` — which
is broken at the PA listEnum layer and always returns
`DynamicListValuesUndefinedOrInvalid`. This shows up when an agent rebuilds or
modifies an Outlook action via `update_live_flow` and tries to resolve a user
through dynamic options. **Don't fix it by retrying AadGraph** — switch to
`shared_office365users.SearchUserV2` instead (returns the same AAD user shape).
See the `power-automate-build` skill, **Step 3a — Resolving Dynamic Connector
Values**, for the working pattern. `describe_live_connector` (v1.1.6+) returns
this fallback as a structured `fallback` field on the affected parameter.
---
## Step 8 — Apply the Fix
**For expression/data issues**:
```python
defn = mcp("get_live_flow", environmentName=ENV, flowName=FLOW_ID)
acts = defn["properties"]["definition"]["actions"]
# Example: fix split on potentially-null Name
acts["Compose_Names"]["inputs"] = \
"@coalesce(item()?['Name'], 'Unknown')"
conn_refs = defn["properties"]["connectionReferences"]
result = mcp("update_live_flow",
environmentName=ENV,
flowName=FLOW_ID,
definition=defn["properties"]["definition"],
connectionReferences=conn_refs)
print(result.get("error")) # None = success
```
> ⚠️ `update_live_flow` always returns an `error` key.
> A value of `null` (Python `None`) means success.
---
## Step 9 — Verify the Fix
> **Use `resubmit_live_flow_run` to test ANY flow — not just HTTP triggers.**
> `resubmit_live_flow_run` replays a previous run using its original trigger
> payload. This works for **every trigger type**: Recurrence, SharePoint
> "When an item is created", connector webhooks, Button triggers, and HTTP
> triggers. You do NOT need to ask the user to manually trigger the flow or
> wait for the next scheduled run.
>
> The only case where `resubmit` is not available is a **brand-new flow that
> has never run** — it has no prior run to replay.
```python
# 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
import time; time.sleep(30)
new_runs = mcp("get_live_flow_runs", environmentName=ENV, flowName=FLOW_ID, top=3)
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 | `resubmit_live_flow_run` | Cannot be triggered on demand any other way |
| SharePoint / connector trigger | `resubmit_live_flow_run` | Cannot be triggered without creating a real SP item |
| HTTP trigger with **custom** test payload | `trigger_live_flow` | When you need to send different data than the original run |
| Brand-new flow, never run | `trigger_live_flow` (HTTP only) | No prior run exists to resubmit |
### Testing HTTP-Triggered Flows with custom payloads
For flows with a `Request` (HTTP) trigger, use `trigger_live_flow` when you
need to send a **different** payload than the original run:
```python
# First inspect what the trigger expects — read directly from the flow definition
defn = mcp("get_live_flow", environmentName=ENV, flowName=FLOW_ID)
triggers = defn["properties"]["definition"]["triggers"]
manual = next(iter(triggers.values())) # usually the only trigger on HTTP flows
request_schema = manual.get("inputs", {}).get("schema")
print("Expected body schema:", request_schema)
# Response schemas live on Response action(s) in the actions block
for name, act in defn["properties"]["definition"]["actions"].items():
if act.get("type") == "Response":
print(f"Response {name}:", act.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')}")
```
> `trigger_live_flow` handles AAD-authenticated triggers automatically.
> Only works for flows with a `Request` (HTTP) trigger type.
---
## 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` | — | check `properties.state` = "Started" |
| 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 |
> **Rule: never diagnose from error codes alone.** `get_live_flow_run_error`
> identifies the failing action. `get_live_flow_run_action_outputs` reveals
> the actual cause. Always call both.
---
## Reference Files
- [common-errors.md](references/common-errors.md) — Error codes, likely causes, and fixes
- [debug-workflow.md](references/debug-workflow.md) — Full decision tree for complex failures
## Related Skills
- `power-automate-mcp` — Foundation skill: connection setup, MCP helper, tool discovery
- `power-automate-build` — Build and deploy new flows
don't have the plugin yet? install it then click "run inline in claude" again.
debug a failing power automate cloud flow by walking backward from the top-level error through each action's inputs and outputs until you find the root cause. the graph api only surfaces generic error codes like ActionFailed or NotSpecified. this skill uses flowstudio mcp to expose what actually happened inside each action: http status codes, response bodies, null values, expression crashes, auth failures. load this when asked to debug a flow, investigate a failed run, find why an action failed, inspect action outputs, fix a broken flow, diagnose a timeout, or trace a connector error.
FLOWSTUDIO_MCP_TOKEN. subscribe at https://mcp.flowstudio.app. if unreachable or token invalid, all mcp calls fail with http errors.Default-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. found in power automate portal or via list_live_flows.list_live_flows or the flow's share url.get_live_flow_runs.get_live_flow_run_action_outputs returns all actions in the run.call list_live_flows with the environment id to find all flows in that environment. filter by display name to find your target flow. extract the id field (a plain uuid). this becomes your flow id for all subsequent calls.
inputs: environment id
outputs: array of flow objects with id, displayName, state
edge case: if environment has >50 flows, pagination is required; flowstudio will indicate via response wrapper. check for totalCount vs flows.length.
call get_live_flow_runs with environment id and flow id, set top=5 to get the 5 newest runs. the response is an array ordered newest first. each run has name (the run id), status (Failed/Succeeded/Running), startTime, error (null if succeeded), and triggerName.
iterate through and find a run with status: Failed. extract its name field.
inputs: environment id, flow id, top parameter
outputs: array of run objects
edge case: if no failed runs exist in the top 5, increase top or advise user the flow succeeded recently. if get_live_flow_runs times out (>120s), the environment or flow is under heavy load; retry after 30 seconds.
call get_live_flow_run_error with environment id, flow id, and run id. the response contains two arrays: failedActions (ordered outer-to-inner, root cause is the last entry) and allActions (every action's status, including Skipped).
the failedActions array shows which action(s) failed and a generic error code like ActionFailed or NotSpecified. do not stop here. these codes are wrappers; the real cause is in the action's inputs and outputs (step 4).
inputs: environment id, flow id, run id
outputs: object with runName, failedActions array, allActions array
edge case: if failedActions is empty, the run completed but may have had warnings or a Skipped branch; check allActions for non-Succeeded statuses and inspect those actions.
call get_live_flow_run_action_outputs with environment id, flow id, run id, and the name of the last (root) failed action from step 3. this returns an array with one element containing the action's full runtime inputs and outputs.
critical: this step is where you find the real error. generic error codes hide the truth. for http actions, the actual http status code and response body live in outputs.statusCode and outputs.body. for expression errors, the error message is in the error field and shows which null or wrong-type value caused the crash.
inputs: environment id, flow id, run id, action name
outputs: array with one object containing actionName, status, inputs, outputs, error (if failed)
edge case: if the action is inside a loop (apply-to-each), the outputs may contain an array; always inspect the first failed item in that array. if outputs is null or empty, the action did not complete; check the error field instead. if response payloads exceed 5 mb, flowstudio truncates them; inspect the truncated body for clues and consider running a smaller subset of data.
call get_live_flow with environment id and flow id. the response contains the entire flow definition under properties.definition. inspect the actions object to find the failing action by name. read its inputs expression to understand what data it expects and where it reads from (e.g., body('HTTP_GetData')?['users']).
inputs: environment id, flow id
outputs: object containing properties.definition with triggers and actions objects
edge case: large flows with >100 actions may have slow responses; use a 60+ second timeout. the definition is the ground truth for understanding data flow and expression logic.
if the failing action's inputs reference upstream actions (e.g., body('Compose_WeekEnd')?['value']), call get_live_flow_run_action_outputs for each upstream action to inspect their outputs. walk the chain backward until you find the source of bad data (null fields, wrong shape, missing keys).
loop through action names in reverse order of execution. for each, extract the outputs and compare against what the downstream action expected. null or mismatched fields are the culprit.
inputs: environment id, flow id, run id, multiple action names
outputs: array of objects, one per action, containing inputs and outputs
edge case: array-processing actions (apply-to-each, filter) produce large outputs. slice output json before printing (e.g., [:500] chars) to avoid memory issues. if you omit the actionName parameter, you get all actions in one call; useful for exploratory debugging but may timeout on flows with >100 actions.
match the error pattern to one of these buckets:
split on null, missing property): the action's inputs reference a field that is null in the upstream output. inspect the upstream action's output to confirm the field is missing or has wrong type. the fix is to add a coalesce, if, or safely-navigate operator.triggerBody()?['fieldName'] but that field does not exist in the actual trigger output. inspect the trigger action's outputs (named in the flow definition's triggers object) to see the real field names.statusCode: 500 (or 4xx) and a response body with the server's error message or stack trace. the error code was a wrapper; this is the real problem.ConnectionAuthorizationFailed or similar. the connection owner does not match the service account running the flow. this cannot be fixed via api; fix in the power automate designer by reconnecting.DynamicListValuesUndefinedOrInvalid on an outlook action like GetEmailsV3. the builtin AadGraph.GetUsers is broken at the pa listEnum layer. do not retry it; switch to shared_office365users.SearchUserV2 instead. see the power-automate-build skill for the working pattern.inputs: the action's inputs and outputs from steps 4 and 6
outputs: identification of the root cause (null field, wrong path, http error, auth failure, or broken connector operation)
edge case: nested json error bodies (http responses with json strings inside json) require double-parsing. if you see a string value in the error body, try json.loads() on it. recursive errors (an error object contains another error object) may require multiple levels of unwrapping.
once you have pinpointed the root cause, modify the flow definition and redeploy it.
for expression / data issues:
get_live_flow to fetch the full definitiondefinition.actionsinputs expression to add null-coalescing, fix field names, or add guardsupdate_live_flow with the modified definition and the current connectionReferences from the flow objectupdate_live_flow always returns an error key. if it is null (python None) the update succeeded. if it is a string, the update failed; read the error message.for connector / auth issues:
for outlook dynamic values:
AadGraph.GetUsers call with shared_office365users.SearchUserV2. see power-automate-build skill step 3a.inputs: the modified flow definition, the original connection references
outputs: response object with error field (null on success, string on failure)
edge case: if the flow has multiple connection references, ensure you pass all of them in the update call, not just the ones you edited. missing connection refs will be deleted. large definition uploads may timeout; use 120+ second timeout.
use resubmit_live_flow_run to replay the failed run with the updated flow. this works for any trigger type (recurrence, sharepoint, webhook, button, http) and ensures the fix is validated against the exact data that originally failed.
call resubmit_live_flow_run with environment id, flow id, and the original run id. the response confirms the resubmission. wait 30 seconds then call get_live_flow_runs with top=1 to check the new run's status.
if the new run's status is Succeeded, the fix worked. if it is Failed, repeat steps 3-8 with the new run id.
inputs: environment id, flow id, run id
outputs: object with resubmitted: true and triggerName; then a new run object from get_live_flow_runs
edge case: resubmit_live_flow_run is not available for brand-new flows that have never run (no prior trigger data to replay). for http-triggered flows only, use trigger_live_flow to send a custom test payload. recurrence and connector-triggered flows cannot be tested manually any other way; resubmit is the only option.
if flow has never run: no prior run exists to resubmit. if the flow has an http (request) trigger, use trigger_live_flow with a test payload instead. otherwise, ask the user to manually trigger the flow or wait for the next scheduled execution.
if get_live_flow_runs returns no failed runs in top 5: either the flow has been stable recently, or failures are older. increase the top parameter to check further back. if no failures exist, advise the user that recent runs have succeeded.
if failedActions is empty in step 3: the flow's status is Failed but no action has a Failed status. check allActions for Skipped or Timeout statuses. a Skipped action means a condition prevented it from running; inspect the condition logic. a Timeout means the action ran too long; check for infinite loops or slow connectors.
if the failing action is inside an apply-to-each or filter: the outputs array contains multiple items. iterate through them to find which one failed. the first failed item in the array is usually the culprit.
if the error code is generic (ActionFailed, NotSpecified, InternalServerError): this is the entire point of this skill. do not try to decode the error code. jump immediately to step 4 and inspect the action's actual outputs.
if the action's output is null or truncated: the action may have crashed before producing output, or the response was too large. check the error field for details. if truncated, consider splitting the flow into smaller batches or filtering the input data.
if an expression error mentions a function name (e.g. split, substring, json): the function received a null or wrong-type argument. walk backward to the upstream action that produced that argument and inspect its output.
if an http action returns 401 or 403: likely auth failure. check the headers, api key, or oauth token in the action's inputs. if the connection owner is wrong, reconnect in the designer.
if an http action returns 500 and the body is a stack trace: the backend crashed. forward the trace to the api owner or support. if it is your own api, debug the backend code.
if resubmit succeeds but the new run fails with a different error: the first fix partially worked but uncovered a downstream issue. repeat steps 3-8 with the new run id.
success is defined as:
update_live_flow with no errorget_live_flow_runs shows the new run with status: Succeededif the root cause is a connector limitation (e.g. outlook dynamic values) or auth issue (connection owner), the output is the explanation and the manual fix steps, not code changes.
output is a summary report:
ROOT CAUSE: <action name> , <specific error>
INPUT: <the expression or data that failed>
OUTPUT: <the null/wrong value that was produced>
FIX APPLIED: <change made to the definition, or "manual fix required">
VERIFICATION: <new run status and link to run details>
the user knows the fix worked when:
if a resubmit run shows status Succeeded, the user can be confident the fix is correct and the flow is unblocked.
| symptom | first tool | then always call | what to look for |
|---|---|---|---|
| flow marked Failed | get_live_flow_run_error |
get_live_flow_run_action_outputs on root action |
http status and response body, or expression error detail |
| error code is generic | step 3 result | get_live_flow_run_action_outputs |
outputs.body contains the real error message or stack trace |
| http 500 or 4xx | , | get_live_flow_run_action_outputs |
outputs.statusCode and outputs.body with server error |
| expression crash | , | get_live_flow_run_action_outputs on prior action |
null or wrong-type field in output |
| action returns wrong data | get_live_flow_run_action_outputs |
, | compare actual output shape vs expected |
| flow never starts | get_live_flow |
, | check properties.state is "Started" |
| fix applied but still fails | get_live_flow_runs after resubmit |
, | new run status field |
rule: never diagnose from error codes alone. get_live_flow_run_error identifies the failing action. get_live_flow_run_action_outputs reveals the actual cause. always call both.
import json, urllib.request, time
MCP_URL = "https://mcp.flowstudio.app/mcp"
MCP_TOKEN = "<YOUR_JWT_TOKEN>"
ENV = "Default-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
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'])}")
return json.loads(raw["result"]["content"][0]["text"])
# step 1: find the flow
flows = mcp("list_live_flows", environmentName=ENV)
target = next(f for f in flows["flows"] if "My Flow Name" in f["displayName"])
FLOW_ID = target["id"]
print(f"Flow ID: {FLOW_ID}")
# step 2: find the failing run
runs = mcp("get_live_flow_runs", environmentName=ENV, flowName=FLOW_ID, top=5)
failed_run = next((r for r in runs if r["status"] == "Failed"), None)
if not failed_run:
print("No failed runs found")
exit(1)
RUN_ID = failed