gitbutlerapp/gitbutler · error

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

Error message

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

What it means

repository_from_roots (crates/but/src/command/mcp/mod.rs:515) bails when the client advertised roots support but list_roots returned an empty list — there is nothing to probe for a Git repository, so the explicit `repository` argument is required.

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 caf1f223d3)

Solutions

  1. Add the project folder as a workspace root in the MCP client, then retry.
  2. Or pass the `repository` argument explicitly.
  3. Check the client's roots/permissions UI to confirm at least one root is exposed.

Example fix

// before
{ "review_numbers": [12] }  // client roots: []

// after: add the folder as a root in the client, or
{ "repository": "/home/user/project", "review_numbers": [12] }
Defensive patterns

Strategy: validation

Validate before calling

if repository.is_none() {
    let roots = peer.list_roots().await?;
    ensure!(!roots.roots.is_empty(), "client exposes no roots; pass repository explicitly");
}

Try / catch

if let Err(err) = resolve_repository(None, context).await {
    if err.to_string().contains("did not provide any filesystem roots") {
        // ask the user to add a workspace root, or retry with explicit path
    }
}

Prevention

When it happens

Trigger: Calling an MCP tool without `repository` when the client supports roots but has no roots configured (empty workspace), or all roots were denied/hidden.

Common situations: The project folder was never added to the MCP client's workspace; client launched in an empty directory; permissions revoked all roots.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20). Data as JSON: /api/errors/4614a725b5a3b3f1. Report an issue: GitHub.