{"record":{"id":"89acad8a9491e255","repo":"Hmbown/CodeWhale","slug":"mcp-server-server-was-not-found","errorCode":null,"errorMessage":"MCP server '{server}' was not found.","messagePattern":"MCP server '(.+?)' was not found\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tui/ui/handlers.rs","lineNumber":555,"sourceCode":"    let progress = Arc::clone(&pending.progress);\n    app.mcp_login = Some(pending);\n    report_mcp_login(\n        app,\n        app.tr(MessageId::McpLoginStarting)\n            .replace(\"{server}\", &name)\n            .replace(\"{cancel_key}\", \"Esc\"),\n        StatusToastLevel::Info,\n    );\n\n    tokio::spawn(async move {\n        let handshake = async {\n            let cfg = crate::mcp::load_config_with_workspace_and_plugins(\n                &path,\n                &workspace,\n                plugin_registry.as_ref(),\n            )?;\n            let server = cfg.servers.get(&name).ok_or_else(|| {\n                anyhow::anyhow!(\n                    codewhale_localization::tr(locale, MessageId::McpLoginServerNotFound)\n                        .replace(\"{server}\", &name)\n                )\n            })?;\n            crate::mcp::oauth::begin_oauth_login_for_server_tool(\n                &name,\n                server,\n                (!scopes.is_empty()).then_some(scopes),\n                callback_port,\n                callback_url.as_deref(),\n                network_policy.as_ref(),\n            )\n            .await\n        };\n        let operation = async {\n            // Bound the whole handshake as well as each guarded HTTP request.\n            // The timeout is in the background: even an unresponsive issuer\n            // cannot delay redraw, input or cancellation.","sourceCodeStart":537,"sourceCodeEnd":573,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tui/ui/handlers.rs#L537-L573","documentation":"Thrown by start_mcp_login when the MCP server name given for an OAuth login does not exist in the loaded MCP configuration. The config is loaded via load_config_with_workspace_and_plugins (including plugin-registered servers) and `cfg.servers.get(&name)` returns None. The message is produced from the localized McpLoginServerNotFound template with `{server}` substituted.","triggerScenarios":"Calling the MCP UI login action (handle_mcp_ui_action -> start_mcp_login) with a server name that is absent from the mcp config file at `path` and from any plugin registry servers — e.g. a typo'd name, a server removed from config, or the wrong config path being loaded.","commonSituations":"Renaming or deleting a server in the MCP config while the TUI still shows a stale snapshot; passing a name from a different config file than the one loaded; plugin providing the server not enabled so the merged config lacks it.","solutions":["Verify the server name matches a `servers` entry in your MCP config (check spelling/case).","Confirm the TUI is loading the config file you edited (workspace path / plugin registry).","Re-run discovery or reload MCP config so the server list is fresh, then retry login.","If the server comes from a plugin, enable that plugin so its servers appear in the merged config."],"exampleFix":"// before\nbegin_oauth_login_for_server_tool(&name, ...)?;\n// after: validate first\nif !cfg.servers.contains_key(&name) {\n    eprintln!(\"server '{name}' not in config; available: {:?}\",\n        cfg.servers.keys().collect::<Vec<_>>());\n    return Ok(());\n}\nbegin_oauth_login_for_server_tool(&name, ...)?;","handlingStrategy":"validation","validationCode":"let cfg = crate::mcp::load_config_with_workspace_and_plugins(&path, &workspace, plugin_registry.as_ref())?;\nif !cfg.servers.contains_key(&name) {\n    eprintln!(\"unknown server '{name}'; known: {:?}\", cfg.servers.keys().collect::<Vec<_>>());\n    return Ok(());\n}","typeGuard":null,"tryCatchPattern":"match start_mcp_login(app, &name).await {\n    Ok(()) => {},\n    Err(e) if e.to_string().contains(\"was not found\") => {\n        status(format!(\"Server '{name}' not in config — reload the server list\"));\n    }\n    Err(e) => status(format!(\"MCP login failed: {e:#}\")),\n}","preventionTips":["Always derive server names from the loaded config's `servers` keys, never from memory.","Refresh the TUI's MCP snapshot after editing the config file or toggling plugins.","Enable the plugin that registers the server before attempting login.","Match names exactly — the lookup is case-sensitive map access."],"tags":["mcp","oauth","config","not-found"],"backgroundTag":"record-not-found","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}