{"record":{"id":"d467d41950a97359","repo":"Hmbown/CodeWhale","slug":"plugin-registry-workspace-does-not-match-mcp-pool","errorCode":null,"errorMessage":"plugin registry workspace does not match MCP pool workspace","messagePattern":"plugin registry workspace does not match MCP pool workspace","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/mcp.rs","lineNumber":2839,"sourceCode":"    /// Create a pool from global MCP config plus workspace-local\n    /// `.codewhale/mcp.json`. Project servers override same-name global\n    /// servers and default stdio `cwd` to the workspace root.\n    #[cfg(test)]\n    pub fn from_config_path_with_workspace(\n        path: &std::path::Path,\n        workspace: &Path,\n    ) -> Result<Self> {\n        let plugins = Arc::new(crate::plugins::PluginRegistry::empty(workspace));\n        Self::from_config_path_with_workspace_and_plugins(path, workspace, plugins)\n    }\n\n    pub fn from_config_path_with_workspace_and_plugins(\n        path: &std::path::Path,\n        workspace: &Path,\n        plugins: Arc<crate::plugins::PluginRegistry>,\n    ) -> Result<Self> {\n        if plugins.workspace() != workspace {\n            anyhow::bail!(\"plugin registry workspace does not match MCP pool workspace\");\n        }\n        let config = load_config_with_workspace_and_plugins(path, workspace, plugins.as_ref())?;\n        let workspace = checked_workspace_path(workspace)?;\n        let mut pool = Self::new(config);\n        pool.config_sources = vec![\n            path.to_path_buf(),\n            checked_workspace_mcp_config_path(&workspace)?,\n        ];\n        pool.config_sources\n            .extend(crate::config::workspace_trust_config_candidate_paths());\n        pool.last_mtimes = pool\n            .config_sources\n            .iter()\n            .map(|source| mcp_config_mtime(source))\n            .collect();\n        pool.workspace = Some(workspace);\n        pool.plugin_registry = Some(plugins);\n        Ok(pool)","sourceCodeStart":2821,"sourceCodeEnd":2857,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/mcp.rs#L2821-L2857","documentation":"`McpPool::from_config_path_with_workspace_and_plugins` requires that the supplied `PluginRegistry` was constructed for exactly the same workspace path being given to the pool. A mismatch means config loads and plugin enumeration would disagree about the workspace, so the constructor refuses up front.","triggerScenarios":"Calling `from_config_path_with_workspace_and_plugins(path, workspace, plugins)` where `plugins.workspace() != workspace` (different `Path` values, including non-canonicalized variants).","commonSituations":"Passing a registry built for a different project directory, comparing unsymlinked vs resolved paths, or a relative vs absolute path mix-up.","solutions":["Pass the same workspace path the PluginRegistry was built with (compare canonicalized paths).","Rebuild the PluginRegistry with `PluginRegistry::new(<workspace>)` for this workspace before constructing the pool.","Canonicalize both paths (e.g. `std::fs::canonicalize`) before comparing to avoid symlink/relative mismatches."],"exampleFix":"// before\nlet plugins = PluginRegistry::new(&other_workspace);\nMcpPool::from_config_path_with_workspace_and_plugins(&path, &workspace, plugins)?\n// after\nlet plugins = PluginRegistry::new(&workspace);\nMcpPool::from_config_path_with_workspace_and_plugins(&path, &workspace, plugins)?","handlingStrategy":"validation","validationCode":"let ws_canon = std::fs::canonicalize(workspace)?;\nlet reg_canon = std::fs::canonicalize(plugins.workspace())?;\nassert_eq!(ws_canon, reg_canon, \"registry workspace must equal pool workspace\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always build the PluginRegistry from the same (canonicalized) workspace passed to the pool.","Never share one registry across workspaces in tests or multi-project setups.","Canonicalize paths to absorb symlinks and relative-vs-absolute differences."],"tags":["mcp","configuration","workspace","plugin"],"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-23T08:17:48.524Z"}