spacedriveapp/spacedrive · error · anyhow::Error

Failed to parse cloud path: {}

Error message

Failed to parse cloud path: {}

What it means

Wraps the SdPathParseError from SdPath::from_uri() when the interactive cloud-location flow concatenates the volume's mount point with the user-entered cloud path (mount_point_str + cloud_path) and parses the result. Because a scheme-separated URI is being built (e.g. s3://bucket/photos), failure means the scheme of the mount point is not recognized by CloudServiceType::from_scheme, or the combined string is malformed.

Source

Thrown at apps/cli/src/domains/location/mod.rs:222

		// Get cloud path within the volume
		let cloud_path = text(
			"Enter path within volume (e.g., / for root or /photos)",
			false,
		)?
		.unwrap();

		// Construct service-based URI: mount_point + path
		let mount_point_str = mount_point.to_string_lossy();
		let full_uri = if cloud_path.starts_with('/') {
			format!("{}{}", mount_point_str, cloud_path)
		} else {
			format!("{}/{}", mount_point_str, cloud_path)
		};

		// Parse the URI to create SdPath
		SdPath::from_uri(&full_uri)
			.map_err(|e| anyhow::anyhow!("Failed to parse cloud path: {}", e))?
	};

	// 2. Name (optional)
	let name = text("Location name", true)?;

	// 3. Index mode
	let mode_idx = select(
		"Select indexing mode",
		&[
			"Content (recommended - indexes file metadata and content hashes)".to_string(),
			"Shallow (metadata only - faster)".to_string(),
			"Deep (full analysis - slowest)".to_string(),
		],
	)?;

	let mode = match mode_idx {
		0 => IndexMode::Content,
		1 => IndexMode::Shallow,

View on GitHub (pinned to 6dfeccf211)

Solutions

  1. Enter only the path within the volume (e.g. /photos), not a full URI, at the 'Enter path within volume' prompt
  2. Check the volume's mount point with the volume list command; re-add it via 'sd volume add-cloud' if its scheme is unrecognized
  3. Avoid '://' inside the cloud path segment
  4. Ensure CLI and daemon builds match so both know the same cloud service schemes

Example fix

// before: pasting a full URI silently builds a corrupt URI
let cloud_path = text("Enter path within volume (e.g., / for root or /photos)", false)?.unwrap();

// after: reject full URIs at the prompt
let cloud_path = text("Enter path within volume (e.g., / for root or /photos)", false)?.unwrap();
anyhow::ensure!(!cloud_path.contains("://"), "Enter a path inside the volume, not a full URI");
Defensive patterns

Strategy: validation

Validate before calling

// Validate the joined URI before handing it to from_uri
let full_uri = format!("{}{}", mount_point_str, cloud_path);
anyhow::ensure!(
    full_uri.matches("://").count() == 1,
    "cloud path must be a path inside the volume, not a full URI"
);
anyhow::ensure!(
    sd_core::volume::backend::CloudServiceType::from_scheme(
        full_uri.split_once(":://").unwrap().0
    ).is_some(),
    "mount point scheme is not a supported cloud service"
);
let sd_path = SdPath::from_uri(&full_uri)?;

Type guard

fn cloud_uri_is_parseable(mount_point: &std::path::Path, cloud_path: &str) -> bool {
    let uri = format!("{}{}", mount_point.to_string_lossy(), cloud_path);
    uri.matches("://").count() == 1 && SdPath::from_uri(&uri).is_ok()
}

Try / catch

match SdPath::from_uri(&full_uri) {
    Ok(p) => p,
    Err(SdPathParseError::UnknownScheme) => anyhow::bail!(
        "volume '{}' has unsupported mount point '{}'; re-add it with sd volume add-cloud",
        selected_volume.name, mount_point_str
    ),
    Err(e) => return Err(anyhow::anyhow!("Failed to parse cloud path: {}", e)),
}

Prevention

When it happens

Trigger: A tracked volume whose mount point uses an unsupported or stale scheme string; a cloud path that itself contains '://' so splitn(2, "://") mis-splits the URI; an empty mount point making the joined string a bare local path that then mismatches expectations downstream.

Common situations: Volume registered under a cloud service that this build no longer supports; mount point edited to a custom scheme; pasting a full URI like s3://bucket/x as the 'path within volume' so the join produces s3://buckets3://bucket/x.

Understand the failure class

Related errors


AI-assisted analysis of spacedriveapp/spacedrive@6dfeccf211 (2026-08-16). Data as JSON: /api/errors/be344c28bb872db0. Report an issue: GitHub.