{"record":{"id":"c41c0bd217f40da2","repo":"spacedriveapp/spacedrive","slug":"device-not-found-in-registry-not-paired-or-off-c41c0b","errorCode":null,"errorMessage":"Device {} not found in registry (not paired or offline)","messagePattern":"Device (.+?) not found in registry \\(not paired or offline\\)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"core/src/service/network/transports/sync.rs","lineNumber":40,"sourceCode":"#[async_trait::async_trait]\nimpl NetworkTransport for NetworkingService {\n\t/// Send a sync message to a target device\n\t///\n\t/// # Implementation Details\n\t///\n\t/// 1. Look up NodeId for device UUID via DeviceRegistry\n\t/// 2. Serialize the SyncMessage to JSON bytes\n\t/// 3. Send via Iroh endpoint using the sync protocol ALPN\n\t/// 4. Handle errors gracefully (device may be offline)\n\tasync fn send_sync_message(&self, target_device: Uuid, message: SyncMessage) -> Result<()> {\n\t\t// 1. Look up NodeId for device UUID via public getter\n\t\tlet device_registry_arc = self.device_registry();\n\t\tlet node_id = {\n\t\t\tlet registry = device_registry_arc.read().await;\n\t\t\tregistry\n\t\t\t\t.get_node_id_for_device(target_device)\n\t\t\t\t.ok_or_else(|| {\n\t\t\t\t\tanyhow::anyhow!(\n\t\t\t\t\t\t\"Device {} not found in registry (not paired or offline)\",\n\t\t\t\t\t\ttarget_device\n\t\t\t\t\t)\n\t\t\t\t})?\n\t\t};\n\n\t\ttracing::info!(\n\t\t\t\"Sending sync message to device {} (node {}), type: {:?}, library: {}\",\n\t\t\ttarget_device,\n\t\t\tnode_id,\n\t\t\tstd::mem::discriminant(&message),\n\t\t\tmessage.library_id()\n\t\t);\n\n\t\t// 2. Serialize message to bytes\n\t\tlet bytes = serde_json::to_vec(&message)\n\t\t\t.map_err(|e| anyhow::anyhow!(\"Failed to serialize sync message: {}\", e))?;\n","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/core/src/service/network/transports/sync.rs#L22-L58","documentation":"get_node_id_for_device(target_device) on the DeviceRegistry returned None in send_sync_message. The registry maps paired device UUIDs to iroh NodeIds; absence means the device was never paired, has been unpaired, or its entry lacks a recorded NodeId (for example a pairing created before node-id capture existed).","triggerScenarios":"Sending to an unpaired device UUID; passing a library or instance identifier where a device UUID is expected; device unpaired concurrently with the send; legacy pairing rows with no NodeId.","commonSituations":"After reinstalling or resetting a device identity; migrations that drop node-id data; frontend confusion between identifier kinds.","solutions":["Verify the UUID is the paired device's UUID, not a library or instance id","Re-pair the device so the registry records its current NodeId","Backfill NodeIds for legacy pairing entries via a migration","Restrict sync target selection in UI/CLI to paired devices"],"exampleFix":"// before\nnet.send_sync_message(device_id, msg).await?;\n\n// after\nlet known = net.device_registry().read().await\n    .get_node_id_for_device(device_id)\n    .is_some();\nif !known {\n    tracing::warn!(device = %device_id, \"skip sync: device not paired\");\n    return Ok(());\n}\nnet.send_sync_message(device_id, msg).await?;","handlingStrategy":"validation","validationCode":"// Run before sending\nlet registry = net.device_registry().read().await;\nif registry.get_node_id_for_device(target_device).is_none() {\n    // not paired: skip, or prompt the user to pair\n    return Ok(());\n}\ndrop(registry);\nnet.send_sync_message(target_device, message).await?;","typeGuard":"fn is_device_not_in_registry(err: &anyhow::Error) -> bool {\n    err.to_string().contains(\"not found in registry\")\n}","tryCatchPattern":"if let Err(e) = net.send_sync_message(device, msg).await {\n    if is_device_not_in_registry(&e) {\n        // expected state: mark unpaired and stop syncing to it; do not retry\n        remove_from_sync_targets(device);\n        return Ok(());\n    }\n    return Err(e);\n}","preventionTips":["Only send to devices listed as paired in the registry","Re-pair after reinstalling or resetting a device","Never substitute library or instance ids for device UUIDs"],"tags":["registry","pairing","sync","rust"],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}