{"record":{"id":"9d66e6f3673896a9","repo":"Hmbown/CodeWhale","slug":"a-managed-project-or-plugin-connector-already-uses-this-name","errorCode":null,"errorMessage":"A managed, project or plugin connector already uses this name","messagePattern":"A managed, project or plugin connector already uses this name","errorType":"validation","errorClass":"anyhow","httpStatus":null,"severity":"error","filePath":"crates/tui/src/mcp/external_import.rs","lineNumber":688,"sourceCode":"    );\n    let (candidate, revision) = super::mutate_config(context.mcp_path, Some(revision), |config| {\n        let (candidates, _) = context.discover();\n        let candidate = candidates\n            .into_iter()\n            .find(|candidate| candidate_id(candidate) == id)\n            .ok_or_else(|| {\n                anyhow::anyhow!(\"Reviewed source is unavailable; refresh the import preview\")\n            })?;\n        anyhow::ensure!(\n            candidate.content_hash == hash,\n            \"Source changed; refresh the import preview\"\n        );\n        if decision == ImportDecision::Approve {\n            anyhow::ensure!(\n                !source_blocked(context, &candidate),\n                \"Source is disabled or its workspace is untrusted\"\n            );\n            anyhow::ensure!(\n                !context.merged()?.servers.contains_key(&candidate.name)\n                    && !config.servers.contains_key(&candidate.name),\n                \"A managed, project or plugin connector already uses this name\"\n            );\n            let mut server = candidate.server.clone();\n            server.enabled = false;\n            server.disabled = true;\n            config.servers.insert(candidate.name.clone(), server);\n        }\n        Ok(candidate)\n    })?;\n    let decisions = HashMap::from([(candidate.name.clone(), decision)]);\n    let now = std::time::SystemTime::now()\n        .duration_since(std::time::UNIX_EPOCH)\n        .map_or(0, |time| time.as_secs());\n    let consent_recorded = persist_decisions(\n        &context.codewhale_home.join(\"mcp-import-consent.json\"),\n        std::slice::from_ref(&candidate),","sourceCodeStart":670,"sourceCodeEnd":706,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/mcp/external_import.rs#L670-L706","documentation":"Before inserting the imported server, apply checks that the name is not already taken by a managed, project, or plugin connector — checked against both the merged view (`context.merged()`) and the file being mutated (`config.servers`). Name collisions would create ambiguous connector references, so approval is refused.","triggerScenarios":"Approving an import whose candidate server name collides with an existing managed/project/plugin MCP server of the same name in the codewhale config.","commonSituations":"Two external clients export a server with the same generic name (e.g. \"filesystem\", \"fetch\"); the user already added that connector manually; a previous import already claimed the name.","solutions":["Rename the existing server or the imported one in its source config so the names differ.","Remove the existing duplicate connector if the imported one should replace it.","Decline this candidate and import the source under a different name after editing the source config."],"exampleFix":"// before (source config)\n{\"mcpServers\": {\"fetch\": {...}}}\n// after\n{\"mcpServers\": {\"fetch-from-claude\": {...}}}","handlingStrategy":"validation","validationCode":"let name = &candidate.name;\nlet taken = context.merged()?.servers.contains_key(name)\n    || config.servers.contains_key(name);\nif taken { eprintln!(\"name {name} already used; rename before importing\"); }","typeGuard":null,"tryCatchPattern":"match apply_reviewed_import(...) {\n    Err(e) if e.to_string().contains(\"already uses this name\") => {\n        // rename in the source config or remove the existing connector, then retry\n    }\n    other => other?,\n}","preventionTips":["Give imported servers unique, source-qualified names","Check existing config for name collisions before previewing","Avoid generic names like \"fetch\" or \"filesystem\" in shared configs"],"tags":["naming-conflict","mcp","import"],"backgroundTag":"conflicting-config-options","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T06:17:15.046Z"}