Power Automate Debug — Power Automate 调试
v1.1.6调试 fAIling Power Automate cloud flows using the FlowStudio MCP server. The Graph API only shows top-level 状态 codes. This 技能 gives your 代理 action-level 输入s and 输出s to find the actual root cause. Load this 技能 when asked to: 调试 a flow, investigate a fAIled 运行, why is this flow fAIling, inspect action 输出s, find the root cause of a flow error, fix a broken Power Automate flow, 诊断 a timeout, 追踪 a DynamicOperation请求失败, 检查 connector auth errors, read error detAIls from a 运行, or troubleshoot expression 失败s. Requires a FlowStudio MCP subscription — see https://mcp.flowstudio.应用
运行时依赖
安装命令
点击复制技能文档
Power Automate 调试ging with FlowStudio MCP
A step-by-step diagnostic process for investigating fAIling Power Automate cloud flows through the FlowStudio MCP server.
Real 调试ging 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 JWT. See the power-automate-mcp 技能 for connection 设置up. Subscribe at https://mcp.flowstudio.应用
Source of Truth
Always call 工具s/列出 first to confirm avAIlable 工具 names and their parameter 模式s. 工具 names and parameters may change between server versions. This 技能 covers 响应 shapes, behavioral notes, and diagnostic patterns — things 工具s/列出 cannot tell you. If this document disagrees with 工具s/列出 or a real API 响应, the API wins.
Python 辅助工具 导入 json, urllib.请求
MCP_URL = "https://mcp.flowstudio.应用/mcp" MCP_令牌 = ""
def mcp(工具, **kwargs): payload = json.dumps({"jsonrpc": "2.0", "id": 1, "method": "工具s/call", "params": {"name": 工具, "arguments": kwargs}}).encode() req = urllib.请求.请求(MCP_URL, data=payload, headers={"x-API-key": MCP_令牌, "Content-Type": "应用/json", "User-代理": "FlowStudio-MCP/1.0"}) try: resp = urllib.请求.urlopen(req, timeout=120) except urllib.error.HTTPError as e: body = e.read().decode("utf-8", errors="replace") rAIse 运行timeError(f"MCP HTTP {e.code}: {body[:200]}") from e raw = json.loads(resp.read()) if "error" in raw: rAIse 运行timeError(f"MCP error: {json.dumps(raw['error'])}") return json.loads(raw["结果"]["content"][0]["text"])
ENV = "<环境-id>" # e.g. Default-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Step 1 — Locate the Flow 结果 = mcp("列出_live_flows", 环境Name=ENV) # Returns a wr应用er object: {mode, flows, totalCount, error} tar获取 = next(f for f in 结果["flows"] if "My Flow Name" in f["displayName"]) FLOW_ID = tar获取["id"] # plAIn UUID — use directly as flowName print(FLOW_ID)
Step 2 — Find the FAIling 运行 运行s = mcp("获取_live_flow_运行s", 环境Name=ENV, flowName=FLOW_ID, top=5) # Returns direct array (newest first): # [{"name": "08584296068667933411438594643CU15", # "状态": "FAIled", # "启动Time": "2026-02-25T06:13:38.6910688Z", # "endTime": "2026-02-25T06:15:24.1995008Z", # "triggerName": "manual", # "error": {"code": "ActionFAIled", "message": "An action fAIled..."}}, # {"name": "...", "状态": "Succeeded", "error": null, ...}]
for r in 运行s: print(r["name"], r["状态"], r["启动Time"])
运行_ID = next(r["name"] for r in 运行s if r["状态"] == "FAIled")
Step 3 — 获取 the Top-Level Error
CRITICAL: 获取_live_flow_运行_error tells you which action fAIled. 获取_live_flow_运行_action_输出s tells you why. You must call 机器人H. Never 停止 at the error alone — error codes like ActionFAIled, NotSpecified, and InternalServerError are generic wr应用ers. The actual root cause (wrong field, null value, HTTP 500 body, stack 追踪) is only visible in the action's 输入s and 输出s.
err = mcp("获取_live_flow_运行_error", 环境Name=ENV, flowName=FLOW_ID, 运行Name=运行_ID) # Returns: # { # "运行Name": "08584296068667933411438594643CU15", # "fAIledActions": [ # {"actionName": "应用ly_to_each_prepare_workers", "状态": "FAIled", # "error": {"code": "ActionFAIled", "message": "An action fAIled..."}, # "启动Time": "...", "endTime": "..."}, # {"actionName": "HTTP_find_AD_User_by_Name", "状态": "FAIled", # "code": "NotSpecified", "启动Time": "...", "endTime": "..."} # ], # "allActions": [ # {"actionName": "应用ly_to_each", "状态": "Skipped"}, # {"actionName": "Compose_WeekEnd", "状态": "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.获取('code')}")
# allActions shows every action's 状态 — useful for spotting what was Skipped # See common-errors.md to decode the error code.
Step 4 — Inspect the FAIling Action's 输入s and 输出s
This is the most 导入ant step. 获取_live_flow_运行_error only gives you a generic error code. The actual error detAIl — HTTP 状态 codes, 响应 bodies, stack 追踪s, null values — lives in the action's 运行time 输入s and 输出s. Always inspect the fAIling action immediately after identifying it.
# 获取 the root fAIling action's full 输入s and 输出s root_action = err["fAIledActions"][-1]["actionName"] detAIl = mcp("获取_live_flow_运行_action_输出s", 环境Name=ENV, flowName=FLOW_ID, 运行Name=运行_ID, actionName=root_action)
out = detAIl[0] if detAIl else {} print(f"Action: {out.获取('actionName')}") print(f"状态: {out.获取('状态')}")
# For HTTP actions, the real error is in 输出s.body if isinstance(out.获取("输出s"), dict): 状态_code = out[