{"record":{"id":"4e0a2edb763ced03","repo":"spacedriveapp/spacedrive","slug":"invalid-path","errorCode":null,"errorMessage":"Invalid path: {}","messagePattern":"Invalid path: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"apps/cli/src/domains/location/args.rs","lineNumber":47,"sourceCode":"\t/// Display name for the location\n\t#[arg(long)]\n\tpub name: Option<String>,\n\n\t/// Indexing mode\n\t#[arg(long, value_enum)]\n\tpub mode: Option<IndexModeArg>,\n}\n\nimpl LocationAddArgs {\n\t/// Build an SdPath from the args (non-interactive mode)\n\tpub fn build_sd_path(&self) -> anyhow::Result<SdPath> {\n\t\tlet path_str = self\n\t\t\t.path\n\t\t\t.as_ref()\n\t\t\t.ok_or_else(|| anyhow::anyhow!(\"Path is required in non-interactive mode\"))?;\n\n\t\t// Use SdPath::from_uri() to parse service-based paths or local paths\n\t\tSdPath::from_uri(path_str).map_err(|e| anyhow::anyhow!(\"Invalid path: {}\", e))\n\t}\n\n\t/// Check if interactive mode should be triggered\n\tpub fn is_interactive(&self) -> bool {\n\t\tself.path.is_none()\n\t}\n}\n\n#[derive(Args, Debug)]\npub struct LocationRemoveArgs {\n\tpub location_id: Uuid,\n\t#[arg(long, short = 'y', default_value_t = false)]\n\tpub yes: bool,\n}\n\nimpl From<LocationRemoveArgs> for LocationRemoveInput {\n\tfn from(args: LocationRemoveArgs) -> Self {\n\t\tSelf {","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/apps/cli/src/domains/location/args.rs#L29-L65","documentation":"Wraps the SdPathParseError returned by SdPath::from_uri() (core/src/domain/addressing.rs:419). from_uri splits on '://'; a string without a scheme is always accepted as a local Physical path, so this error only comes from scheme-prefixed URIs: UnknownScheme (scheme not a recognized CloudServiceType), InvalidContentId (content:// with a bad UUID), or InvalidSidecar* variants (sidecar:// with a malformed path/kind/format).","triggerScenarios":"Passing --path gdrive://my-bucket/photos when the scheme is not a supported cloud service; content://not-a-uuid; sidecar://<uuid>/thumbs with missing extension or wrong kind directory.","commonSituations":"Assuming a cloud provider is supported because its URI looks standard; copy-pasting sidecar URIs with truncated variants; version drift where a scheme was added/removed from CloudServiceType::from_scheme.","solutions":["For local paths, pass a plain absolute path like /mnt/media (no scheme) - that never fails to parse","For cloud paths, use a scheme CloudServiceType::from_scheme recognizes (e.g. s3://bucket/key)","For content:// URIs, ensure the remainder is a valid UUID","For sidecar:// URIs, use the form sidecar://<uuid>/<kind>/<variant>.<ext> with kind in thumbs|proxies|embeddings|ocr|transcript"],"exampleFix":"// before\nSdPath::from_uri(path_str).map_err(|e| anyhow::anyhow!(\"Invalid path: {}\", e))\n\n// after: reject unsupported schemes with a specific hint\nlet scheme = path_str.split_once(\"://\").map(|(s, _)| s);\nif let Some(s) = scheme {\n    anyhow::ensure!(\n        matches!(s, \"local\" | \"content\" | \"sidecar\") || sd_core::volume::backend::CloudServiceType::from_scheme(s).is_some(),\n        \"Unsupported path scheme '{}'\" ,\n        s\n    );\n}\nSdPath::from_uri(path_str).map_err(|e| anyhow::anyhow!(\"Invalid path: {}\", e))","handlingStrategy":"validation","validationCode":"fn uri_scheme(uri: &str) -> Option<&str> {\n    uri.split_once(\"://\").map(|(s, _)| s)\n}\n\n// Only scheme-prefixed strings can fail; validate the scheme first\nif let Some(s) = uri_scheme(path_str) {\n    anyhow::ensure!(\n        matches!(s, \"local\" | \"content\" | \"sidecar\")\n            || sd_core::volume::backend::CloudServiceType::from_scheme(s).is_some(),\n        \"unsupported scheme '{}' - use a plain path or a recognized cloud scheme\",\n        s\n    );\n}\nlet sd_path = SdPath::from_uri(path_str)?;","typeGuard":"fn parses_as_sd_path(uri: &str) -> bool {\n    SdPath::from_uri(uri).is_ok()\n}","tryCatchPattern":"match SdPath::from_uri(path_str) {\n    Ok(p) => p,\n    Err(SdPathParseError::UnknownScheme) => anyhow::bail!(\"'{}' is not a supported cloud scheme; pass a local path without a scheme\", path_str),\n    Err(SdPathParseError::InvalidContentId) => anyhow::bail!(\"content:// URI needs a valid UUID\"),\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Plain absolute local paths never fail from_uri - prefer them for local locations","Keep a list of supported cloud schemes in sync with CloudServiceType::from_scheme","Validate scheme-prefixed user input before it reaches location add"],"tags":["cli","location","paths","uri-parsing"],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}