{"record":{"id":"0b67d5a0cd11974e","repo":"gitbutlerapp/gitbutler","slug":"none-of-the-mcp-client-s-filesystem-roots-identify","errorCode":null,"errorMessage":"None of the MCP client's filesystem roots identify a Git repository. {}","messagePattern":"None of the MCP client's filesystem roots identify a Git repository\\. (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/mcp/mod.rs","lineNumber":535,"sourceCode":"        );\n    }\n\n    let mut failures = Vec::new();\n    for root in roots {\n        let path = match root_path(root) {\n            Ok(path) => path,\n            Err(err) => {\n                failures.push(err.to_string());\n                continue;\n            }\n        };\n        match open_repository(&path) {\n            Ok(resolved) => return Ok(resolved),\n            Err(err) => failures.push(format!(\"{}: {err:#}\", path.display())),\n        }\n    }\n\n    bail!(\n        \"None of the MCP client's filesystem roots identify a Git repository. {}\",\n        failures.join(\"; \")\n    )\n}\n\nfn root_path(root: &Root) -> Result<PathBuf> {\n    let url = Url::parse(&root.uri)\n        .with_context(|| format!(\"MCP root is not a valid URI: {}\", root.uri))?;\n    url.to_file_path()\n        .map_err(|()| anyhow::anyhow!(\"MCP root is not a file URI: {}\", root.uri))\n}\n\nfn open_repository(repository: &Path) -> Result<ResolvedRepository> {\n    let repository = repository\n        .canonicalize()\n        .with_context(|| format!(\"Could not resolve repository at {}\", repository.display()))?;\n    let ctx = but_ctx::Context::discover(&repository)\n        .with_context(|| format!(\"Could not open repository at {}\", repository.display()))?;","sourceCodeStart":517,"sourceCodeEnd":553,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/mcp/mod.rs#L517-L553","documentation":"The server iterates the MCP client's filesystem roots trying to open each as a Git repository. If every root fails to open (none is a git repo), it bails listing the per-root failure reasons. This tells the caller that exposed roots exist but none is a usable Git repository.","triggerScenarios":"All roots returned by the MCP client point at directories where open_repository fails — non-git directories, bare/unreadable repos, or paths that error on open.","commonSituations":"Pointing the MCP client at a home/parent directory instead of a repo; target folder without a .git directory; permission problems on the repository path.","solutions":["Pass the `repository` argument explicitly pointing at a valid Git repository","Expose a folder that is inside a Git repository as a filesystem root in the client","Run `git init` (or open an existing clone) in the folder exposed as a root, and check path permissions"],"exampleFix":"// before\nroots: [\"/home/user\"] // not a git repo\n// after\nroots: [\"/home/user/my-project\"] // a git repository","handlingStrategy":"validation","validationCode":"import { existsSync } from 'fs';\nif (!existsSync(path.join(rootPath, '.git')) && !existsSync(path.join(rootPath, 'HEAD'))) throw new Error(`${rootPath} is not a git repo`);","typeGuard":null,"tryCatchPattern":"try { await callTool(name, args); } catch (e) { if (/not identify a Git repository/.test(e.message)) args.repository = pickRepoRoot(e); }","preventionTips":["Expose project folders (inside a repo) as roots, not parent/home directories","Run `git status` in the exposed root to confirm it is a repository","Check read permissions on the repository directory"],"tags":["mcp","git","configuration"],"backgroundTag":"path-is-not-a-directory","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}