{"record":{"id":"a18da5862433de60","repo":"iflytek/astron-agent","slug":"run-mcp-plugin-url-is-not-set","errorCode":null,"errorMessage":"RUN_MCP_PLUGIN_URL is not set","messagePattern":"RUN_MCP_PLUGIN_URL is not set","errorType":"exception","errorClass":"RunMcpPluginExc","httpStatus":null,"severity":"error","filePath":"core/agent/service/plugin/mcp.py","lineNumber":44,"sourceCode":"    async def run(self, action_input: dict, span: Span) -> Any:\n        with span.start(\"Run\") as sp:\n            start_time = int(round(time.time() * 1000))\n            data = {\n                \"mcp_server_id\": self.server_id,\n                \"mcp_server_url\": self.server_url,\n                \"tool_name\": self.name,\n                \"tool_args\": action_input,\n                \"sid\": sp.sid,\n            }\n            sp.add_info_events(\n                attributes={\n                    \"mcp-plugin-run-inputs\": json.dumps(data, ensure_ascii=False)\n                }\n            )\n            try:\n                run_url = os.getenv(\"RUN_MCP_PLUGIN_URL\")\n                if not run_url:\n                    raise RunMcpPluginExc(\"RUN_MCP_PLUGIN_URL is not set\")\n                async with aiohttp.ClientSession() as session:\n                    timeout = aiohttp.ClientTimeout(\n                        total=int(os.getenv(\"MCP_CALL_TIMEOUT\", \"90\"))\n                    )\n                    async with session.post(\n                        run_url,\n                        json=data,\n                        headers={\"Content-Type\": \"application/json\"},\n                        timeout=timeout,\n                    ) as response:\n                        response.raise_for_status()\n                        if response.status == 200:\n                            resp = await response.json()\n                            sp.add_info_events(\n                                attributes={\n                                    \"mcp-plugin-run-outputs\": json.dumps(\n                                        resp, ensure_ascii=False\n                                    )","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/agent/service/plugin/mcp.py#L26-L62","documentation":"RunMcpPluginExc raised in McpPluginRunner.run (mcp.py:44). Before POSTing to the MCP plugin runner, the code reads the RUN_MCP_PLUGIN_URL environment variable; if it is unset (or empty), it raises immediately with 'RUN_MCP_PLUGIN_URL is not set' (code 40027). This is a pure deployment/configuration error: no HTTP call is ever made.","triggerScenarios":"Invoking any MCP server tool while the agent process was started without RUN_MCP_PLUGIN_URL in its environment.","commonSituations":"Docker Compose / Helm values missing the env var, .env not mounted into the agent container, typo in the variable name, or a fresh deployment where the MCP plugin service endpoint was never configured.","solutions":["Set RUN_MCP_PLUGIN_URL (e.g. http://mcp-plugin:8080/run) in the agent service's environment and restart the service.","In docker: add it to the core/agent environment section of docker compose or the .env file; in Helm: set it in the agent deployment values.","Add a startup-time fail-fast check that validates required plugin URL env vars so the misconfiguration is caught at boot instead of at first tool call."],"exampleFix":"// before (docker-compose)\nagent:\n  environment:\n    - LIST_MCP_PLUGIN_URL=http://mcp-plugin:8080/list\n// after\nagent:\n  environment:\n    - LIST_MCP_PLUGIN_URL=http://mcp-plugin:8080/list\n    - RUN_MCP_PLUGIN_URL=http://mcp-plugin:8080/run","handlingStrategy":"validation","validationCode":"run_url = os.getenv(\"RUN_MCP_PLUGIN_URL\")\nif not run_url:\n    raise RuntimeError(\"RUN_MCP_PLUGIN_URL must be set before invoking MCP tools\")","typeGuard":null,"tryCatchPattern":"try:\n    result = await runner.run(action_input, span)\nexcept RunMcpPluginExc as e:\n    if \"not set\" in str(e):\n        logger.critical(\"MCP plugin not configured: %s\", e)\n    raise","preventionTips":["Declare RUN_MCP_PLUGIN_URL in docker compose / Helm values and .env.example","Fail fast at agent startup if required MCP env vars are missing","Document required env vars for any MCP-tool-enabled deployment","Avoid typos: centralize env var names as constants"],"tags":["mcp","plugin","configuration","environment"],"backgroundTag":"missing-env-var","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}