{"record":{"id":"ccffc1d46f2df52a","repo":"gitbutlerapp/gitbutler","slug":"path-does-not-exist-path","errorCode":null,"errorMessage":"Path does not exist: {path}","messagePattern":"Path does not exist: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but-api/src/open/mod.rs","lineNumber":536,"sourceCode":"        };\n    } else if cfg!(windows) {\n        #[cfg(windows)]\n        fn create_new_console(cmd: &mut Command) -> &mut Command {\n            use std::os::windows::process::CommandExt;\n            // CREATE_NEW_CONSOLE: Creates a new console for the process (0x00000010)\n            // This allows the terminal to run independently without blocking our thread\n            const CREATE_NEW_CONSOLE: u32 = 0x00000010;\n            cmd.creation_flags(CREATE_NEW_CONSOLE)\n        }\n        #[cfg(not(windows))]\n        fn create_new_console(cmd: &mut Command) -> &mut Command {\n            cmd\n        }\n\n        // Validate path exists and canonicalize it to proper Windows format\n        let path_buf = Path::new(&path);\n        if !path_buf.exists() {\n            bail!(\"Path does not exist: {path}\");\n        }\n        if !path_buf.is_dir() {\n            bail!(\"Path is not a directory: {path}\");\n        }\n\n        // Canonicalize to get the absolute, properly formatted Windows path\n        // This converts forward slashes to backslashes and resolves . and ..\n        let canonical_path = gix::path::realpath(path_buf)\n            .with_context(|| format!(\"Failed to canonicalize path: {path}\"))?\n            .to_str()\n            .context(\"BUG: input path is String, should be able to convert back to it\")?\n            .to_owned();\n        let canonical_path = &canonical_path;\n\n        // Check if the terminal binary exists in PATH before attempting to launch.\n        let binary_found = which::which(&terminal_id).is_ok();\n        if !binary_found {\n            return Err(anyhow::anyhow!(\"'{terminal_id}' was not found.\")","sourceCodeStart":518,"sourceCodeEnd":554,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but-api/src/open/mod.rs#L518-L554","documentation":"Before launching a terminal on Windows, open_in_terminal() validates the path: if the path does not exist on disk it bails with this error. Windows is the only platform branch performing this explicit existence check, since terminals there are launched with an explicit canonicalized working directory.","triggerScenarios":"Calling open_in_terminal on Windows with a path string pointing to a non-existent directory (deleted project, wrong drive letter, UNC typo).","commonSituations":"Stale project paths after a repo move/rename, mistyped drive letters, network drives not mounted, or WSL-style paths (/home/...) passed to the Windows branch.","solutions":["Verify the path exists (e.g. in Explorer or via existsSync / Path::new(path).exists())","Fix the path: correct drive letter and separators, ensure network drives are mounted","Re-open the project from its current location so stored paths refresh"],"exampleFix":"// before\nopen_in_terminal(\"powershell\", \"C:\\\\repos\\\\old-name\") // deleted\n// after\nopen_in_terminal(\"powershell\", \"C:\\\\repos\\\\new-name\")","handlingStrategy":"validation","validationCode":"import { existsSync } from 'fs';\nfunction safeTerminalPath(p: string): string | null {\n  return existsSync(p) ? p : null;\n}","typeGuard":"fn is_existing_path(p: &str) -> bool { Path::new(p).exists() }","tryCatchPattern":null,"preventionTips":["Check the path exists before calling open_in_terminal on Windows","Refresh stored project paths after moves/renames","Ensure network drives are mounted before launching terminals in them"],"tags":["path","windows","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"}