gitbutlerapp/gitbutler · error

The path does not exist

Error message

The path {} does not exist

What it means

Thrown by the `but setup` command when adding a project to the project registry fails with `AddProjectOutcome::PathNotFound`. GitButler checked the given path on disk and could not find it at all, so it refuses to register the repository. The error message interpolates the offending path via `repo_path.display()`.

Solutions

  1. Verify the path exists: run `ls <path>` (or `test -d <path>`) and correct any typo.
  2. Re-run `but setup` from inside the repository or pass its absolute path.
  3. If the repo was moved or deleted, re-clone or update the stored path before setup.

Example fix

// before
but setup ~/projcts/myrepo
// after
but setup ~/projects/myrepo
Defensive patterns

Strategy: validation

Validate before calling

const path = repoPath;
if (!fs.existsSync(path)) {
  throw new Error(`Fix path before running but setup: ${path} does not exist`);
}

Type guard

function isExistingPath(p: string): boolean {
  try { return fs.existsSync(p); } catch { return false; }
}

Try / catch

try {
  await run(['but', 'setup', repoPath]);
} catch (e) {
  if (String(e).includes('does not exist')) {
    console.error(`Path ${repoPath} not found; check spelling and that the clone still exists.`);
  }
  throw e;
}

Prevention

When it happens

Trigger: Running `but setup` (or the legacy add-project flow) with a repo path that does not exist on disk; the project-registry add call returns AddProjectOutcome::PathNotFound.

Common situations: Typo in the path passed to setup; running setup from a directory that was moved, renamed, or deleted; using a relative path from the wrong working directory; stale config pointing at a removed clone.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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

Appendix: source

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

                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 58e5313667)