{"record":{"id":"f3498922c794bcec","repo":"gitbutlerapp/gitbutler","slug":"project-path-not-found","errorCode":null,"errorMessage":"project path not found","messagePattern":"project path not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gitbutler-project/src/project.rs","lineNumber":319,"sourceCode":"\nimpl AddProjectOutcome {\n    /// This is for tests only.\n    ///\n    /// Unwraps the `Project` if the project was actually added.\n    /// Panics if it was not.\n    pub fn unwrap_project(self) -> Project {\n        match self {\n            AddProjectOutcome::Added(p) => p,\n            _ => panic!(\"called `AddProjectOutcome::unwrap_project()` on a non-project outcome\"),\n        }\n    }\n\n    /// Try to get the `Project`, returning an error if it was not added.\n    pub fn try_project(self) -> anyhow::Result<Project> {\n        match self {\n            AddProjectOutcome::Added(p) => Ok(p),\n            AddProjectOutcome::AlreadyExists(_) => Err(anyhow::anyhow!(\"project already exists\")),\n            AddProjectOutcome::PathNotFound => Err(anyhow::anyhow!(\"project path not found\")),\n            AddProjectOutcome::NotADirectory => {\n                Err(anyhow::anyhow!(\"project path is not a directory\"))\n            }\n            AddProjectOutcome::BareRepository => {\n                Err(anyhow::anyhow!(\"bare repositories are not supported\"))\n            }\n            AddProjectOutcome::NonMainWorktree => {\n                Err(anyhow::anyhow!(\"non-main worktrees are not supported\"))\n            }\n            AddProjectOutcome::NoWorkdir => Err(anyhow::anyhow!(\"no workdir found for repository\")),\n            AddProjectOutcome::NoDotGitDirectory => {\n                Err(anyhow::anyhow!(\"no .git directory found in repository\"))\n            }\n            AddProjectOutcome::ReftableRefFormatUnsupported => Err(anyhow::anyhow!(\n                \"unsupported repository reference format: reftable\"\n            )),\n            AddProjectOutcome::NotAGitRepository(msg) => {\n                Err(anyhow::anyhow!(\"not a git repository: {msg}\"))","sourceCodeStart":301,"sourceCodeEnd":337,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/gitbutler-project/src/project.rs#L301-L337","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Verify the path exists before adding (`ls <path>` / `Path::exists()` in code) and correct any typo.","Re-select the folder via the directory picker rather than typing the path.","If the project moved, add it at its new location.","Mount or reconnect the drive/network share holding the directory."],"exampleFix":"// before\nlet project = add_project(any_path)?.try_project()?;\n// after\nif !any_path.exists() {\n    return Err(format!(\"path {} does not exist\", any_path.display()).into());\n}\nlet project = add_project(any_path)?.try_project()?;","handlingStrategy":"validation","validationCode":"fn path_addable(path: &std::path::Path) -> Result<(), String> {\n    if !path.exists() { return Err(\"path does not exist\".into()); }\n    if !path.is_dir() { return Err(\"path is not a directory\".into()); }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"match outcome.try_project() {\n    Err(e) if e.to_string() == \"project path not found\" => {\n        // re-prompt for a valid directory\n        prompt_for_directory()?;\n    }\n    other => other,\n}","preventionTips":["Use a directory picker rather than free-text path entry.","Validate the path exists immediately before adding (TOCTOU-safe flow).","Remount network drives before adding projects stored on them."],"tags":["project","path","validation"],"backgroundTag":"file-not-found","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}