{"record":{"id":"7ad15a6042112310","repo":"iflytek/astron-agent","slug":"mcp-error","errorCode":"MCP_ERROR","errorMessage":"MCP node output identifier is empty","messagePattern":"MCP node output identifier is empty","errorType":"error_code","errorClass":"CustomException","httpStatus":null,"severity":"error","filePath":"core/workflow/engine/nodes/mcp/mcp_node.py","lineNumber":119,"sourceCode":"                    res_json = json.loads(await resp.text())\n                    await span.add_info_events_async(\n                        {\"mcp_response\": json.dumps(res_json, ensure_ascii=False)}\n                    )\n\n                    # Check for errors in response\n                    if res_json.get(\"code\") != 0:\n                        msg = f\"reason {res_json.get('message')}\"\n                        span.add_error_event(msg)\n                        raise CustomException(\n                            err_code=CodeEnum.MCP_REQUEST_ERROR,\n                            err_msg=msg,\n                            cause_error=msg,\n                        )\n\n            if not self.output_identifier:\n                msg = \"MCP node output identifier is empty\"\n                span.add_error_event(msg)\n                raise CustomException(\n                    err_code=CodeEnum.MCP_ERROR,\n                    err_msg=msg,\n                    cause_error=msg,\n                )\n            outputs = {self.output_identifier[0]: res_json.get(\"data\", {})}\n            return NodeRunResult(\n                status=status,\n                inputs=inputs,\n                outputs=outputs,\n                node_id=self.node_id,\n                node_type=self.node_type,\n                alias_name=self.alias_name,\n            )\n        except CustomException as err:\n            span.add_error_event(str(err))\n            span.record_exception(err)\n            return NodeRunResult(\n                inputs=inputs,","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/workflow/engine/nodes/mcp/mcp_node.py#L101-L137","documentation":"After a successful MCP call, the node needs output_identifier — the field name(s) used to extract the tool result into node outputs. If output_identifier is empty, it raises CustomException MCP_ERROR because the result cannot be mapped to output variables.","triggerScenarios":"An MCP node configured with a valid server and tool but no output identifier configured (output variable mapping left blank), then executed successfully at the HTTP level but failing at the output-mapping step.","commonSituations":"User forgot to define the node's output variable in the workflow editor; an imported workflow JSON omitted output_identifier; UI field reset after editing the tool selection.","solutions":["Configure output_identifier (at least one entry) in the MCP node settings so the tool result is mapped to an output variable","Re-open the node in the workflow editor, set the output variable, and re-save the workflow","If the field is set programmatically, ensure it's a non-empty list, e.g. [\"result\"]"],"exampleFix":"// before\n{\"mcpServerId\": \"srv-123\", \"toolName\": \"web_search\", \"output_identifier\": []}\n// after\n{\"mcpServerId\": \"srv-123\", \"toolName\": \"web_search\", \"output_identifier\": [\"result\"]}","handlingStrategy":"validation","validationCode":"oid = node_config.get(\"output_identifier\")\nif not isinstance(oid, list) or len(oid) == 0 or not oid[0]:\n    raise ValueError(\"MCP node requires a non-empty output_identifier, e.g. ['result']\")","typeGuard":"def has_output_identifier(cfg: dict) -> bool:\n    oid = cfg.get(\"output_identifier\")\n    return isinstance(oid, list) and len(oid) > 0 and bool(oid[0])","tryCatchPattern":"try:\n    result = await node.async_execute(variable_pool, span)\nexcept CustomException as e:\n    if e.err_code == CodeEnum.MCP_ERROR:\n        # prompt user to configure the node's output variable\n        ...","preventionTips":["Make output_identifier a required field in the MCP node editor form","Validate MCP node configs at workflow save/import time","Reset output mapping whenever the tool selection changes"],"tags":["python","config","workflow","mcp"],"backgroundTag":"missing-required-config-field","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}