{"record":{"id":"0db4013a551cdaa0","repo":"spacedriveapp/spacedrive","slug":"leader-must-be-local-or-remote","errorCode":null,"errorMessage":"Leader must be 'local' or 'remote'","messagePattern":"Leader must be 'local' or 'remote'","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"apps/cli/src/domains/library/args.rs","lineNumber":162,"sourceCode":"\t\tlet local_device_id = if let Some(id) = self.local_device {\n\t\t\tid\n\t\t} else {\n\t\t\t// Read device config to get current device ID\n\t\t\tlet config_path = ctx.data_dir.join(\"device.json\");\n\t\t\tif !config_path.exists() {\n\t\t\t\tanyhow::bail!(\"Device config not found. Please specify --local-device\");\n\t\t\t}\n\t\t\tlet config_data = std::fs::read_to_string(&config_path)?;\n\t\t\tlet device_config: sd_core::device::DeviceConfig = serde_json::from_str(&config_data)?;\n\t\t\tdevice_config.id\n\t\t};\n\n\t\t// Determine leader device ID\n\t\tlet leader = self.leader.as_deref().unwrap_or(\"local\");\n\t\tlet leader_device_id = match leader {\n\t\t\t\"local\" => local_device_id,\n\t\t\t\"remote\" => remote_device,\n\t\t\t_ => anyhow::bail!(\"Leader must be 'local' or 'remote'\"),\n\t\t};\n\n\t\t// Parse action\n\t\tlet action_str = self.action.as_deref().unwrap_or(\"share-local\");\n\t\tlet action =\n\t\t\tmatch action_str {\n\t\t\t\t\"share-local\" => {\n\t\t\t\t\tlet name = self.name.clone().ok_or_else(|| {\n\t\t\t\t\t\tanyhow::anyhow!(\"--name is required for share-local action\")\n\t\t\t\t\t})?;\n\t\t\t\t\tLibrarySyncAction::ShareLocalLibrary { library_name: name }\n\t\t\t\t}\n\t\t\t\t\"join-remote\" => {\n\t\t\t\t\tlet remote_library_id = self.remote_library.ok_or_else(|| {\n\t\t\t\t\t\tanyhow::anyhow!(\"--remote-library is required for join-remote action\")\n\t\t\t\t\t})?;\n\t\t\t\t\tlet name = self.name.clone().ok_or_else(|| {\n\t\t\t\t\t\tanyhow::anyhow!(\"--name is required for join-remote action\")","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/apps/cli/src/domains/library/args.rs#L144-L180","documentation":"Error \"Leader must be 'local' or 'remote'\" thrown in spacedriveapp/spacedrive.","triggerScenarios":"Thrown at apps/cli/src/domains/library/args.rs:162 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}