$npx -y skills add microsoft/power-platform-skills --skill debug-flowDebug a failed Power Automate flow run. Use when a flow failed, has errors, or the user wants to troubleshoot a run.
| 1 | # Debug a Failed Flow Run |
| 2 | |
| 3 | You are helping the user debug a failed Power Automate flow run. |
| 4 | |
| 5 | ## Tools |
| 6 | |
| 7 | This skill uses the **FlowAgent MCP tools**. Clients surface them with a |
| 8 | client-specific prefix — `mcp__flowagent__<tool>` (Claude Code) or |
| 9 | `flowagent-<tool>` (Copilot CLI) — so they're referred to by bare name below. |
| 10 | If MCP tools aren't available, run `/setup` to wire the FlowAgent MCP server. |
| 11 | |
| 12 | | Tool | Purpose | |
| 13 | |------|---------| |
| 14 | | `list_flows` | Find flows by name (use `name` param for search) | |
| 15 | | `get_run_history` | Get recent runs for a flow | |
| 16 | | `diagnose_run` | One-shot: classify failed actions with remediations | |
| 17 | | `get_run_details` | Get details for a specific run | |
| 18 | | `get_run_actions` | Get action-level execution trace | |
| 19 | | `get_run_action_repetitions` | Iteration-level detail for a loop (which iteration failed — pass an action **inside** the loop) | |
| 20 | | `get_flow` | Get flow definition for context | |
| 21 | | `get_operation_details` | Confirm the correct action type / parameters | |
| 22 | | `edit_flow` | Apply a surgical fix to one action/parameter | |
| 23 | | `update_flow` | Replace the whole definition (large rewrites) | |
| 24 | | `run_flow` | Re-run after fix (use `wait: true` to see result) | |
| 25 | | `resubmit_run` / `cancel_run` | Resubmit a fixed run / cancel a stuck one | |
| 26 | |
| 27 | ## Steps |
| 28 | |
| 29 | 1. **Identify the flow and run** |
| 30 | - Parse `$ARGUMENTS` for flow ID and optional run ID. |
| 31 | - If no flow ID, call `list_flows` with `name` param to search. Ask user to pick if ambiguous. |
| 32 | - If no run ID, call `get_run_history` and find the most recent failed run. |
| 33 | - Present recent runs in a table: Run ID | Status | Start Time | Error |
| 34 | |
| 35 | 2. **Fast triage with `diagnose_run`** |
| 36 | - Call `diagnose_run` for the run — it returns the failed/timed-out actions already classified with a remediation each. Use this as the starting point. |
| 37 | - For deeper analysis, also fetch (in parallel): `get_run_actions` (full trace) and `get_flow` (definition context). For a failed loop, call `get_run_action_repetitions` on an action **inside** the loop to find the failing iteration. |
| 38 | |
| 39 | 3. **Analyze failures** |
| 40 | - Identify actions with status != "Succeeded" |
| 41 | - Trace the `runAfter` dependency chain to separate root cause from cascading failures: |
| 42 | - **Root cause**: action whose dependencies all Succeeded but it failed |
| 43 | - **Cascading**: actions skipped because a dependency failed |
| 44 | - Report root cause actions with: name, type, error code, error message |
| 45 | |
| 46 | 4. **Root cause classification** |
| 47 | - **Connection errors** (`AuthorizationFailed`, `ConnectionNotFound`, `InvokerConnectionOverrideFailed`): Suggest re-auth or fix connection source to Embedded |
| 48 | - **Expression errors** (`ExpressionEvaluationFailed`, `InvalidTemplate`): Show the expression, explain what's wrong, suggest fix |
| 49 | - **API/External errors** (401/403/404/429/500+): Explain the HTTP error, check connector status |
| 50 | - **Parameter errors** (`WorkflowOperationParametersRuntimeMissingValue`): Missing/empty required parameter. Add null guard: `@if(empty(...), 'd |