gitbutlerapp/gitbutler · error

The MCP client did not provide any filesystem roots. Pass…

Error message

The MCP client did not provide any filesystem roots. Pass the repository argument explicitly.

What it means

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.

Solutions

  1. Pass the `repository` argument explicitly to the tool call
  2. Open/add a folder in the MCP client so it exposes at least one filesystem root
  3. Check client settings restricting which directories are exposed to the server

Example fix

// before
{"arguments": {}} // client exposes no roots
// after
{"arguments": {"repository": "/path/to/repo"}}
Defensive patterns

Strategy: validation

Validate before calling

if (!clientCapabilities.roots) args.repository = repoPath; // avoid relying on roots listing

Try / catch

try { await callTool(name, args); } catch (e) { if (/did not provide any filesystem roots/.test(e.message)) retryWithExplicitRepo(e); }

Prevention

When it happens

Trigger: MCP client advertises roots capability but returns zero roots when `list_roots()`/roots listing is called, with no `repository` argument in the request.

Common situations: 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.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/4614a725b5a3b3f1. Report an issue: GitHub.

Appendix: source

Thrown at crates/but/src/command/mcp/mod.rs:515

    let supports_roots = peer
        .peer_info()
        .is_some_and(|client| client.capabilities.roots.is_some());
    if !supports_roots {
        bail!(
            "No repository was provided and this MCP client does not expose filesystem roots. Pass the repository argument explicitly."
        );
    }

    let roots = peer
        .list_roots()
        .await
        .context("Could not request filesystem roots from the MCP client")?;
    repository_from_roots(&roots.roots)
}

fn repository_from_roots(roots: &[Root]) -> Result<ResolvedRepository> {
    if roots.is_empty() {
        bail!(
            "The MCP client did not provide any filesystem roots. Pass the repository argument explicitly."
        );
    }

    let mut failures = Vec::new();
    for root in roots {
        let path = match root_path(root) {
            Ok(path) => path,
            Err(err) => {
                failures.push(err.to_string());
                continue;
            }
        };
        match open_repository(&path) {
            Ok(resolved) => return Ok(resolved),
            Err(err) => failures.push(format!("{}: {err:#}", path.display())),
        }
    }

View on GitHub (pinned to 58e5313667)