{"record":{"id":"83217284433b19c9","repo":"oraios/serena","slug":"cannot-apply-setup-for-client-client-not-foun","errorCode":null,"errorMessage":"Cannot apply setup for client '{client}' (not found or not functional).","messagePattern":"Cannot apply setup for client '(.+?)' \\(not found or not functional\\)\\.","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"src/serena/cli.py","lineNumber":223,"sourceCode":"\n    @staticmethod\n    @click.command(\n        \"setup\",\n        help=\"Set up Serena for use with a specific client by registering it as an MCP server.\",\n        context_settings={\"max_content_width\": _MAX_CONTENT_WIDTH},\n    )\n    @click.argument(\n        \"client\",\n        type=click.Choice([h.name for h in client_setup_handlers]),\n    )\n    def setup(client: str) -> None:\n        # find the matching handler\n        handler = next(h for h in client_setup_handlers if h.name == client)\n\n        # check applicability\n        if not handler.is_applicable():\n            click.echo(f\"\\nCannot apply setup for client '{client}' (not found or not functional).\\n\")\n            raise SystemExit(1)\n\n        # apply the setup\n        if handler.apply():\n            click.echo(f\"\\nSerena has been successfully set up for {client}.\\n\")\n        else:\n            click.echo(f\"\\nFailed to set up Serena for {client}.\\n\")\n            raise SystemExit(1)\n\n    @staticmethod\n    @click.command(\"start-mcp-server\", help=\"Starts the Serena MCP server.\", context_settings={\"max_content_width\": _MAX_CONTENT_WIDTH})\n    @click.option(\"--project\", \"project\", type=PROJECT_TYPE, default=None, help=\"Path or name of project to activate at startup.\")\n    @click.option(\"--project-file\", \"project\", type=PROJECT_TYPE, default=None, help=\"[DEPRECATED] Use --project instead.\")\n    @click.argument(\"project_file_arg\", type=PROJECT_TYPE, required=False, default=None, metavar=\"\")\n    @click.option(\n        \"--context\", type=str, default=DEFAULT_CONTEXT, show_default=True, help=\"Built-in context name or path to custom context YAML.\"\n    )\n    @click.option(\n        \"--mode\",","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/oraios/serena/blob/7fcbca7e62555ec2287ddb2f083caee805848ea6/src/serena/cli.py#L205-L241","documentation":"The `serena setup <client>` CLI command looks up a client setup handler by name and runs handler.is_applicable() to verify the client's config directory actually exists on this machine. If not applicable it prints this message and raises SystemExit(1), because applying the setup (writing MCP config) would target a nonexistent client installation.","triggerScenarios":"Running `serena setup <client-name>` where the client's configuration directory cannot be found on the system (e.g. no ~/.claude, ~/.cursor, etc. for the chosen handler), or with a client name whose handler reports not functional.","commonSituations":"Client not installed on the machine; client installed under a non-default path (custom HOME, portable installs); typos or unsupported client name selected in the interactive picker; running in a container/WSL where the client lives on the host.","solutions":["Install/launch the target client at least once so its config directory exists, then rerun `serena setup <client>`.","Configure the client manually: add the Serena MCP server entry to the client's MCP config file yourself.","Verify you're running inside the same environment (same HOME/OS) where the client is installed; note WSL vs Windows paths.","Pick a different, supported client via the interactive setup prompt."],"exampleFix":"// before\nserena setup cursor   # ~/.cursor missing\n// after\nmkdir -p ~/.cursor && open cursor once, or edit mcp config manually:\n// { \"mcpServers\": { \"serena\": { \"command\": \"serena\", \"args\": [\"start-mcp-server\"] } } }","handlingStrategy":"validation","validationCode":"import os, pathlib\ndef client_config_exists(handler) -> bool:\n    return callable(getattr(handler, 'is_applicable', None)) and handler.is_applicable()","typeGuard":null,"tryCatchPattern":"try:\n    handler = next(h for h in client_setup_handlers if h.name == client)\nexcept StopIteration:\n    raise SystemExit(f\"Unsupported client: {client}\")\nif not handler.is_applicable():\n    raise SystemExit(f\"Client '{client}' not detected; install it or configure MCP manually\")","preventionTips":["Install and launch the client at least once before running serena setup.","Run serena setup in the same OS/environment (HOME, WSL vs native) where the client is installed.","Fall back to manually editing the client's MCP config when automated setup can't detect the client."],"tags":["cli","setup","mcp-client","environment"],"backgroundTag":"client-not-detected","analyzedSha":"7fcbca7e62555ec2287ddb2f083caee805848ea6","analyzedAt":"2026-08-29T00:04:09.619Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}