{"record":{"id":"4614a725b5a3b3f1","repo":"gitbutlerapp/gitbutler","slug":"the-mcp-client-did-not-provide-any-filesystem-root","errorCode":null,"errorMessage":"The MCP client did not provide any filesystem roots. Pass the repository argument explicitly.","messagePattern":"The MCP client did not provide any filesystem roots\\. Pass the repository argument explicitly\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/mcp/mod.rs","lineNumber":515,"sourceCode":"    let supports_roots = peer\n        .peer_info()\n        .is_some_and(|client| client.capabilities.roots.is_some());\n    if !supports_roots {\n        bail!(\n            \"No repository was provided and this MCP client does not expose filesystem roots. Pass the repository argument explicitly.\"\n        );\n    }\n\n    let roots = peer\n        .list_roots()\n        .await\n        .context(\"Could not request filesystem roots from the MCP client\")?;\n    repository_from_roots(&roots.roots)\n}\n\nfn repository_from_roots(roots: &[Root]) -> Result<ResolvedRepository> {\n    if roots.is_empty() {\n        bail!(\n            \"The MCP client did not provide any filesystem roots. Pass the repository argument explicitly.\"\n        );\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    }","sourceCodeStart":497,"sourceCodeEnd":533,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/mcp/mod.rs#L497-L533","documentation":"After confirming the MCP client supports roots, the server requests the client's filesystem roots. If the client responds with an empty roots list, no repository can be resolved, so the request fails with a message telling the caller to pass the repository argument explicitly.","triggerScenarios":"MCP client advertises roots capability but returns zero roots when `list_roots()`/roots listing is called, with no `repository` argument in the request.","commonSituations":"Clients that declare the roots capability but expose no folders (e.g. no workspace folder open); sandboxed clients that refuse to share directories; IDE sessions started without a project.","solutions":["Pass the `repository` argument explicitly to the tool call","Open/add a folder in the MCP client so it exposes at least one filesystem root","Check client settings restricting which directories are exposed to the server"],"exampleFix":"// before\n{\"arguments\": {}} // client exposes no roots\n// after\n{\"arguments\": {\"repository\": \"/path/to/repo\"}}","handlingStrategy":"validation","validationCode":"if (!clientCapabilities.roots) args.repository = repoPath; // avoid relying on roots listing","typeGuard":null,"tryCatchPattern":"try { await callTool(name, args); } catch (e) { if (/did not provide any filesystem roots/.test(e.message)) retryWithExplicitRepo(e); }","preventionTips":["Open a workspace folder in your IDE so at least one root is exposed","Verify the roots capability actually returns roots before dropping the repository argument","Default to explicit repository arguments in automation"],"tags":["mcp","configuration"],"backgroundTag":"empty-result-set","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"}