{"record":{"id":"e917500cc75f80ff","repo":"Panniantong/Agent-Reach","slug":"mcporter-e91750","errorCode":null,"errorMessage":"mcporter 配置查询失败","messagePattern":"mcporter 配置查询失败","errorType":"exception","errorClass":"McporterConfigError","httpStatus":null,"severity":"error","filePath":"agent_reach/cli.py","lineNumber":2029,"sourceCode":"        print(\"  安装：npm install -g mcporter\")\n        print(\"  然后：mcporter config add exa https://mcp.exa.ai/mcp --scope home\")\n        print()\n    else:\n        try:\n            from agent_reach.channels.mcporter import (\n                McporterConfigError,\n                configured_server_names,\n            )\n\n            r = subprocess.run(\n                [\"mcporter\", \"config\", \"list\", \"--json\"],\n                capture_output=True,\n                encoding=\"utf-8\",\n                errors=\"replace\",\n                timeout=10,\n            )\n            if r.returncode != 0:\n                raise McporterConfigError(\"mcporter 配置查询失败\")\n            if \"exa\" in configured_server_names(r.stdout):\n                print(\"  当前状态: ✅ 已配置\")\n            else:\n                print(\"  当前状态: -- 未配置\")\n                setup_now = input(\"  现在自动配置 Exa 吗？[Y/n]: \").strip().lower()\n                if setup_now in (\"\", \"y\", \"yes\"):\n                    add_r = subprocess.run(\n                        [\n                            \"mcporter\",\n                            \"config\",\n                            \"add\",\n                            \"exa\",\n                            \"https://mcp.exa.ai/mcp\",\n                            \"--scope\",\n                            \"home\",\n                        ],\n                        capture_output=True, encoding=\"utf-8\", errors=\"replace\", timeout=10,\n                    )","sourceCodeStart":2011,"sourceCodeEnd":2047,"githubUrl":"https://github.com/Panniantong/Agent-Reach/blob/93ae1d18c37b707dec053c7c4f9d91cd8ef8943d/agent_reach/cli.py#L2011-L2047","documentation":"During the Exa setup flow, the CLI shells out to `mcporter config list --json` (10s timeout). If that subprocess exits non-zero, it raises McporterConfigError('mcporter 配置查询失败') — the mcporter tool is installed enough to invoke but its config listing failed. The message is Chinese: 'mcporter config query failed'.","triggerScenarios":"Running the interactive Exa configuration step (answering Y to '现在自动配置 Exa 吗？' path, or the status check preceding it) when `mcporter config list` errors: corrupt mcporter config file, incompatible mcporter version without --json support, or mcporter failing on startup env problems.","commonSituations":"mcporter installed via a different package manager with a stale/corrupt ~/.mcporter config; mcporter major-version change altering CLI flags; partial npm installs leaving a broken shim that exits non-zero.","solutions":["Run `mcporter config list --json` manually and read its stderr to find the real failure","If the output shows a corrupt config, repair or remove mcporter's config file and re-initialize","Upgrade/downgrade mcporter to a version whose CLI supports `config list --json`","If mcporter is not needed, skip the Exa flow and configure the MCP server by other means (see config/mcporter.json)"],"exampleFix":"# before: blind interactive attempt\nagent-reach configure   # choose Exa setup, hits 配置查询失败\n\n# after: diagnose the underlying mcporter failure first\nmcporter config list --json; echo \"exit=$?\"\n# fix whatever it reports, then re-run the Exa setup","handlingStrategy":"try-catch","validationCode":"import subprocess\n\ndef mcporter_list_ok() -> bool:\n    try:\n        r = subprocess.run(\n            [\"mcporter\", \"config\", \"list\", \"--json\"],\n            capture_output=True, text=True, timeout=10,\n        )\n        return r.returncode == 0\n    except (OSError, subprocess.TimeoutExpired):\n        return False\n\nif not mcporter_list_ok():\n    skip_exa_setup_with_warning()","typeGuard":null,"tryCatchPattern":"from agent_reach.cli import McporterConfigError  # if importing the flow programmatically\n\ntry:\n    run_exa_setup()\nexcept McporterConfigError:\n    log.warning(\"Exa setup skipped: mcporter config list failed; run `mcporter config list --json` to diagnose\")","preventionTips":["Verify `mcporter config list --json` succeeds in CI before enabling Exa setup steps","Pin the mcporter version so `config list --json` CLI support cannot silently disappear","Keep a manual Exa configuration path documented as fallback"],"tags":["cli","mcporter","subprocess","exa","integration"],"backgroundTag":null,"analyzedSha":"93ae1d18c37b707dec053c7c4f9d91cd8ef8943d","analyzedAt":"2026-08-14T22:54:06.735Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}