{"record":{"id":"0c036b26ad634eec","repo":"Hmbown/CodeWhale","slug":"mcp-server-name-not-found-0c036b","errorCode":null,"errorMessage":"MCP server '{name}' not found","messagePattern":"MCP server '(.+?)' not found","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/mcp.rs","lineNumber":4058,"sourceCode":"            required: false,\n            enabled_tools: Vec::new(),\n            disabled_tools: Vec::new(),\n            headers: HashMap::new(),\n            env_headers: HashMap::new(),\n            bearer_token_env_var: None,\n            scopes: Vec::new(),\n            oauth: None,\n            oauth_resource: None,\n            reviewed_plugin: None,\n        },\n    );\n    save_config(path, &cfg)\n}\n\npub fn remove_server_config(path: &Path, name: &str) -> Result<()> {\n    let mut cfg = load_config(path)?;\n    if cfg.servers.remove(name).is_none() {\n        anyhow::bail!(\"MCP server '{name}' not found\");\n    }\n    save_config(path, &cfg)\n}\n\npub fn set_server_enabled(path: &Path, name: &str, enabled: bool) -> Result<()> {\n    let mut cfg = load_config(path)?;\n    let server = cfg\n        .servers\n        .get_mut(name)\n        .ok_or_else(|| anyhow::anyhow!(\"MCP server '{name}' not found\"))?;\n    server.enabled = enabled;\n    server.disabled = !enabled;\n    save_config(path, &cfg)\n}\n\n#[cfg(test)]\npub fn manager_snapshot_from_config(\n    path: &Path,","sourceCodeStart":4040,"sourceCodeEnd":4076,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/tui/src/mcp.rs#L4040-L4076","documentation":"remove_server_config loads the config file and deletes the named entry from the servers map. If the key is absent, nothing is removed and the operation fails with 'not found' rather than silently rewriting the file as a no-op.","triggerScenarios":"Calling remove_server_config (the remove-server flow) with a name that is not a key in mcp.json - a typo, casing mismatch, or a server contributed dynamically at runtime or by a plugin rather than declared in the file.","commonSituations":"Trying to remove a plugin-contributed or dynamic runtime server through the file-based API; a name copied from another machine's config; the server was already removed.","solutions":["List configured servers (config snapshot or jq '.servers | keys' on mcp.json) and use the exact key","If the target is a dynamic/runtime server, remove it via the runtime API (remove_runtime_server_config), not the file config","Check casing and whitespace in the name"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check existence before removing:\nlet cfg = load_config(&path)?;\nanyhow::ensure!(cfg.servers.contains_key(name), \"server '{name}' is not in {}\", path.display());\nremove_server_config(&path, name)?;","typeGuard":"fn server_exists(cfg: &McpConfig, name: &str) -> bool {\n    cfg.servers.contains_key(name)\n}","tryCatchPattern":null,"preventionTips":["Render server lists from the same config source the remove operation uses","Refresh the server list before prompting the user to pick a server to remove","Remember dynamic/plugin servers are not in mcp.json - use the runtime API for those"],"tags":["mcp","config","not-found"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}