gitbutlerapp/gitbutler · error

project path not found

Error message

project path not found

What it means

try_project maps the AddProjectOutcome::PathNotFound variant to this error. The path given to the add-project flow does not exist on the filesystem, so no Project can be constructed. This is a user-input validation failure surfaced as a plain anyhow error.

Solutions

  1. Verify the path exists before adding (`ls <path>` / `Path::exists()` in code) and correct any typo.
  2. Re-select the folder via the directory picker rather than typing the path.
  3. If the project moved, add it at its new location.
  4. Mount or reconnect the drive/network share holding the directory.

Example fix

// before
let project = add_project(any_path)?.try_project()?;
// after
if !any_path.exists() {
    return Err(format!("path {} does not exist", any_path.display()).into());
}
let project = add_project(any_path)?.try_project()?;
Defensive patterns

Strategy: validation

Validate before calling

fn path_addable(path: &std::path::Path) -> Result<(), String> {
    if !path.exists() { return Err("path does not exist".into()); }
    if !path.is_dir() { return Err("path is not a directory".into()); }
    Ok(())
}

Try / catch

match outcome.try_project() {
    Err(e) if e.to_string() == "project path not found" => {
        // re-prompt for a valid directory
        prompt_for_directory()?;
    }
    other => other,
}

Prevention

When it happens

Trigger: Adding a project from a path that was deleted, renamed, never existed, or is mistyped (typo in the directory path passed to the add API).

Common situations: Manual path entry with typos; scripts referencing moved directories; adding from a stale file-picker state after the folder was removed; network mounts not currently mounted.

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/f3498922c794bcec. Report an issue: GitHub.

Appendix: source

Thrown at crates/gitbutler-project/src/project.rs:319

impl AddProjectOutcome {
    /// This is for tests only.
    ///
    /// Unwraps the `Project` if the project was actually added.
    /// Panics if it was not.
    pub fn unwrap_project(self) -> Project {
        match self {
            AddProjectOutcome::Added(p) => p,
            _ => panic!("called `AddProjectOutcome::unwrap_project()` on a non-project outcome"),
        }
    }

    /// Try to get the `Project`, returning an error if it was not added.
    pub fn try_project(self) -> anyhow::Result<Project> {
        match self {
            AddProjectOutcome::Added(p) => Ok(p),
            AddProjectOutcome::AlreadyExists(_) => Err(anyhow::anyhow!("project already exists")),
            AddProjectOutcome::PathNotFound => Err(anyhow::anyhow!("project path not found")),
            AddProjectOutcome::NotADirectory => {
                Err(anyhow::anyhow!("project path is not a directory"))
            }
            AddProjectOutcome::BareRepository => {
                Err(anyhow::anyhow!("bare repositories are not supported"))
            }
            AddProjectOutcome::NonMainWorktree => {
                Err(anyhow::anyhow!("non-main worktrees are not supported"))
            }
            AddProjectOutcome::NoWorkdir => Err(anyhow::anyhow!("no workdir found for repository")),
            AddProjectOutcome::NoDotGitDirectory => {
                Err(anyhow::anyhow!("no .git directory found in repository"))
            }
            AddProjectOutcome::ReftableRefFormatUnsupported => Err(anyhow::anyhow!(
                "unsupported repository reference format: reftable"
            )),
            AddProjectOutcome::NotAGitRepository(msg) => {
                Err(anyhow::anyhow!("not a git repository: {msg}"))

View on GitHub (pinned to 58e5313667)