{"record":{"id":"730ccd573c2a9823","repo":"Hmbown/CodeWhale","slug":"mcp-server-name-not-found-730ccd","errorCode":null,"errorMessage":"MCP server '{name}' not found","messagePattern":"MCP server '(.+?)' not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tui/ui/handlers.rs","lineNumber":775,"sourceCode":"                .map(|()| message = Some(format!(\"Removed MCP server '{name}'\")))\n        }\n        crate::tui::app::McpUiAction::Login { name, scopes } => {\n            start_mcp_login(app, config, name, scopes);\n            // Login owns its background discovery. Do not start a second\n            // discovery here or await network work on the input loop.\n            return;\n        }\n        crate::tui::app::McpUiAction::Logout { name } => {\n            let result = (|| {\n                let cfg = mcp::load_config_with_workspace_and_plugins(\n                    &path,\n                    &app.workspace,\n                    app.plugin_registry.as_ref(),\n                )?;\n                let server = cfg\n                    .servers\n                    .get(&name)\n                    .ok_or_else(|| anyhow::anyhow!(\"MCP server '{name}' not found\"))?;\n                mcp::oauth::delete_oauth_tokens_for_server(&name, server)\n            })();\n            result.map(|deleted| {\n                changed = deleted;\n                message = Some(if deleted {\n                    format!(\n                        \"Deleted locally stored OAuth credentials for MCP server '{name}'. That clears this machine only — the provider may keep its grant; the next /mcp login re-prompts for consent. Run /mcp reload to reconnect.\"\n                    )\n                } else {\n                    format!(\"No stored OAuth credentials found for MCP server '{name}'.\")\n                });\n            })\n        }\n        crate::tui::app::McpUiAction::ImportList => {\n            let path = path.clone();\n            let workspace = app.workspace.clone();\n            let plugins = app.plugin_registry.clone();\n            #[cfg(test)]","sourceCodeStart":757,"sourceCodeEnd":793,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tui/ui/handlers.rs#L757-L793","documentation":"Raised in handle_mcp_ui_action when an OAuth token deletion (logout) targets a server name that is not present in the loaded MCP config. `cfg.servers.get(&name)` yields None and an anyhow error with the literal message is returned before delete_oauth_tokens_for_server can run. Unlike the login path (2193), this message is a hardcoded English string, not localized.","triggerScenarios":"Invoking the MCP UI action that deletes OAuth tokens for `{name}` when the name is missing from cfg.servers — stale UI snapshot after config edit, typo, or a server registered only by a currently-disabled plugin.","commonSituations":"Clicking logout on an MCP server entry rendered from a cached snapshot while the underlying config file changed; removing a server from config in another editor while the TUI stays open; running logout for a server whose plugin was disabled.","solutions":["Reload/refresh the MCP server list in the TUI so it reflects the current config, then retry.","Check the server name against the `servers` map in the active MCP config file.","Re-add the server to the config (or re-enable its plugin) if you still need to revoke its stored tokens.","If stale tokens must be removed regardless, delete them from the OAuth token store directly once the name is corrected."],"exampleFix":"// before\nlet server = cfg.servers.get(&name)\n    .ok_or_else(|| anyhow::anyhow!(\"MCP server '{name}' not found\"))?;\nmcp::oauth::delete_oauth_tokens_for_server(&name, server)\n// after: tolerate already-absent servers on logout\nmatch cfg.servers.get(&name) {\n    Some(server) => mcp::oauth::delete_oauth_tokens_for_server(&name, server),\n    None => Ok(false), // nothing stored; treat as already-deleted\n}","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!(\"cannot log out: server '{name}' not configured\");\n    return Ok(());\n}","typeGuard":null,"tryCatchPattern":"match handle_mcp_ui_action(app, McpUiAction::Logout { name }).await {\n    Err(e) if e.to_string().contains(\"not found\") => {\n        status(\"Server removed from config — nothing to log out\");\n    }\n    Err(e) => status(format!(\"logout failed: {e:#}\")),\n    Ok(_) => {},\n}","preventionTips":["Re-sync the server list after any config edit before issuing logout actions.","Treat logout for an absent server as a no-op rather than an error in UI code.","Keep server names in UI state derived from the current config, not stale snapshots.","Verify plugin-enabled servers remain registered before revoking their tokens."],"tags":["mcp","oauth","logout","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"}