gitbutlerapp/gitbutler · error

The path {} does not exist

Error message

The path {} does not exist

What it means

Raised while registering a repository during `but setup`: the `gitbutler_project` crate validated the candidate path and returned `AddProjectOutcome::PathNotFound`, which the CLI maps to this error. It means the path does not exist on the filesystem at all, before any Git checks happen.

Source

Thrown at crates/but/src/command/legacy/setup.rs:234

                writeln!(
                    out,
                    "  {}",
                    t.success.paint("✓ Repository added to project registry")
                )?;
            }
            Ok(ProjectStatus::Added)
        }
        gitbutler_project::AddProjectOutcome::AlreadyExists(_) => {
            if let Some(out) = out.for_human() {
                writeln!(
                    out,
                    "  {}",
                    t.success.paint("✓ Repository already in project registry")
                )?;
            }
            Ok(ProjectStatus::AlreadyExists)
        }
        gitbutler_project::AddProjectOutcome::PathNotFound => Err(anyhow::anyhow!(
            "The path {} does not exist",
            repo_path.display()
        )),
        gitbutler_project::AddProjectOutcome::NotADirectory => Err(anyhow::anyhow!(
            "The path {} is not a directory",
            repo_path.display()
        )),
        gitbutler_project::AddProjectOutcome::BareRepository => Err(anyhow::anyhow!(
            "The repository at {} is bare. GitButler requires a non-bare repository.",
            repo_path.display()
        )),
        gitbutler_project::AddProjectOutcome::NonMainWorktree => Err(anyhow::anyhow!(
            "The repository at {} is a non-main worktree. GitButler requires the main worktree.",
            repo_path.display()
        )),
        gitbutler_project::AddProjectOutcome::NoWorkdir => Err(anyhow::anyhow!(
            "The repository at {} has no working directory. GitButler requires a working directory.",
            repo_path.display()

View on GitHub (pinned to caf1f223d3)

Solutions

  1. Check the path exists (`ls /the/path`) and fix the typo
  2. Use an absolute path, or verify your cwd before using a relative one
  3. If it is a mount point, remount it and rerun
  4. If the directory is supposed to be new, create it and run `git init` inside it first, then rerun setup

Example fix

# before
but setup ~/repso/my-project

# after
but setup ~/repos/my-project
Defensive patterns

Strategy: validation

Validate before calling

match std::fs::metadata(&repo_path) {
    Ok(_) => {}
    Err(e) if e.kind() == std::io::ErrorKind::NotFound => {
        anyhow::bail!("path {repo_path:?} does not exist; fix the path or mount");
    }
    Err(e) => return Err(e.into()),
}

Type guard

fn is_path_not_found(out: &gitbutler_project::AddProjectOutcome) -> bool {
    matches!(out, gitbutler_project::AddProjectOutcome::PathNotFound)
}

Try / catch

match add_project(&repo_path) {
    Ok(out) if is_path_not_found(&out) => { /* tell the user the path is wrong */ }
    Ok(out) => { /* handle other outcomes */ }
    Err(err) if err.to_string().contains("does not exist") => { /* path guidance */ }
    Err(err) => return Err(err),
}

Prevention

When it happens

Trigger: Running the setup command with a path argument (or -C directory) that does not exist: a typo, a relative path resolved from the wrong cwd, or an unmounted volume.

Common situations: Typos in the path (`~/repso` vs `~/repos`); network mounts not yet mounted (macOS /Volumes/*, NFS/SMB shares); stale hard-coded paths in scripts after a directory moved.

Related errors


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