{"record":{"id":"6fe7a9a785033a1d","repo":"spacedriveapp/spacedrive","slug":"path-does-not-exist","errorCode":null,"errorMessage":"Path does not exist: {}","messagePattern":"Path does not exist: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"apps/cli/src/domains/location/mod.rs","lineNumber":155,"sourceCode":"\tuse sd_core::domain::addressing::SdPath;\n\tuse sd_core::ops::indexing::IndexMode;\n\n\tprintln!(\"\\n=== Add New Location ===\\n\");\n\n\t// 1. Location type\n\tlet location_type = select(\n\t\t\"What type of location would you like to add?\",\n\t\t&[\"Local filesystem\".to_string(), \"Cloud storage\".to_string()],\n\t)?;\n\n\tlet sd_path = if location_type == 0 {\n\t\t// Local filesystem\n\t\tlet path_str = text(\"Enter the local path\", false)?.unwrap();\n\t\tlet path_buf = std::path::PathBuf::from(path_str);\n\n\t\t// Validate that path exists\n\t\tif !path_buf.exists() {\n\t\t\tanyhow::bail!(\"Path does not exist: {}\", path_buf.display());\n\t\t}\n\t\tif !path_buf.is_dir() {\n\t\t\tanyhow::bail!(\"Path must be a directory: {}\", path_buf.display());\n\t\t}\n\n\t\tSdPath::local(path_buf)\n\t} else {\n\t\t// Cloud storage\n\t\tuse sd_core::ops::volumes::list::VolumeListQueryInput;\n\n\t\tlet volumes: sd_core::ops::volumes::list::VolumeListOutput = execute_query!(\n\t\t\tctx,\n\t\t\tVolumeListQueryInput {\n\t\t\t\tfilter: sd_core::ops::volumes::VolumeFilter::TrackedOnly\n\t\t\t}\n\t\t);\n\n\t\tif volumes.volumes.is_empty() {","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/apps/cli/src/domains/location/mod.rs#L137-L173","documentation":"Thrown by the interactive location-add flow after the user types a local path and std::path::PathBuf::exists() returns false. The wizard validates existence before creating SdPath::local(path_buf), because an indexed location must point at a real directory on disk.","triggerScenarios":"Typing a path with a typo, a not-yet-created directory, or an unexpanded tilde ('~/photos' is checked literally, shells do not expand it for prompts) in the 'Enter the local path' prompt.","commonSituations":"Tilde or environment variables ($HOME) pasted into the prompt; directory on an unmounted external drive or network mount; the directory lives on the daemon's machine but the path was written for a different machine.","solutions":["Use the absolute path with the tilde already expanded, e.g. /home/user/photos","Create the directory first (mkdir -p) if it should exist","Check the drive/mount is actually mounted on the machine running the daemon","Verify with ls <path> in another terminal before re-entering it"],"exampleFix":"// before: tilde is checked literally and fails\nlet path_str = text(\"Enter the local path\", false)?.unwrap();\nlet path_buf = std::path::PathBuf::from(path_str);\n\n// after: expand ~ before validating\nlet path_str = text(\"Enter the local path\", false)?.unwrap();\nlet expanded = shellexpand::tilde(&path_str).into_owned();\nlet path_buf = std::path::PathBuf::from(expanded);","handlingStrategy":"validation","validationCode":"let expanded = shellexpand::tilde(&path_str).into_owned();\nlet path_buf = std::path::PathBuf::from(&expanded);\nif !path_buf.try_exists().unwrap_or(false) {\n    eprintln!(\"'{}' does not exist (tilde is NOT expanded automatically)\", expanded);\n    return Ok(());\n}","typeGuard":"fn is_existing_dir(p: &str) -> bool {\n    let expanded = shellexpand::tilde(p).into_owned();\n    std::path::Path::new(&expanded).is_dir()\n}","tryCatchPattern":null,"preventionTips":["Always expand ~ and $HOME before passing paths to the CLI","Verify the mount/disk is attached on the daemon's machine, not just your shell's","mkdir -p directories that should exist before adding them as locations"],"tags":["cli","location","filesystem","interactive"],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}