spacedriveapp/spacedrive · error · anyhow::Error

Leader must be 'local' or 'remote'

Error message

Leader must be 'local' or 'remote'

What it means

Error "Leader must be 'local' or 'remote'" thrown in spacedriveapp/spacedrive.

Source

Thrown at apps/cli/src/domains/library/args.rs:162

		let local_device_id = if let Some(id) = self.local_device {
			id
		} else {
			// Read device config to get current device ID
			let config_path = ctx.data_dir.join("device.json");
			if !config_path.exists() {
				anyhow::bail!("Device config not found. Please specify --local-device");
			}
			let config_data = std::fs::read_to_string(&config_path)?;
			let device_config: sd_core::device::DeviceConfig = serde_json::from_str(&config_data)?;
			device_config.id
		};

		// Determine leader device ID
		let leader = self.leader.as_deref().unwrap_or("local");
		let leader_device_id = match leader {
			"local" => local_device_id,
			"remote" => remote_device,
			_ => anyhow::bail!("Leader must be 'local' or 'remote'"),
		};

		// Parse action
		let action_str = self.action.as_deref().unwrap_or("share-local");
		let action =
			match action_str {
				"share-local" => {
					let name = self.name.clone().ok_or_else(|| {
						anyhow::anyhow!("--name is required for share-local action")
					})?;
					LibrarySyncAction::ShareLocalLibrary { library_name: name }
				}
				"join-remote" => {
					let remote_library_id = self.remote_library.ok_or_else(|| {
						anyhow::anyhow!("--remote-library is required for join-remote action")
					})?;
					let name = self.name.clone().ok_or_else(|| {
						anyhow::anyhow!("--name is required for join-remote action")

View on GitHub (pinned to 6dfeccf211)

When it happens

Trigger: Thrown at apps/cli/src/domains/library/args.rs:162 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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