{"record":{"id":"f5e1bfe03e8950c2","repo":"spacedriveapp/spacedrive","slug":"failed-to-connect-to-f5e1bf","errorCode":null,"errorMessage":"Failed to connect to {}: {}","messagePattern":"Failed to connect to (.+?): (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"core/src/service/network/transports/sync.rs","lineNumber":102,"sourceCode":"\n\t\t// Create new connection only if cache miss\n\t\tlet conn = if let Some(conn) = conn {\n\t\t\tconn\n\t\t} else {\n\t\t\ttracing::debug!(\n\t\t\t\tdevice_uuid = %target_device,\n\t\t\t\tnode_id = %node_id,\n\t\t\t\t\"Creating new connection (cache miss)\"\n\t\t\t);\n\n\t\t\tlet new_conn = endpoint.connect(node_id, SYNC_ALPN).await.map_err(|e| {\n\t\t\t\twarn!(\n\t\t\t\t\tdevice_uuid = %target_device,\n\t\t\t\t\tnode_id = %node_id,\n\t\t\t\t\terror = %e,\n\t\t\t\t\t\"Failed to connect to device for sync\"\n\t\t\t\t);\n\t\t\t\tanyhow::anyhow!(\"Failed to connect to {}: {}\", target_device, e)\n\t\t\t})?;\n\n\t\t\t// Add to cache\n\t\t\t{\n\t\t\t\tlet mut connections = active_connections.write().await;\n\t\t\t\tconnections.insert(cache_key, new_conn.clone());\n\t\t\t}\n\n\t\t\t// Track outbound connection so we can receive incoming streams on it\n\t\t\tif let Some(cmd_sender) = self.command_sender() {\n\t\t\t\tuse crate::service::network::core::event_loop::EventLoopCommand;\n\t\t\t\tlet _ = cmd_sender.send(EventLoopCommand::TrackOutboundConnection {\n\t\t\t\t\tnode_id,\n\t\t\t\t\tconn: new_conn.clone(),\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tnew_conn","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/core/src/service/network/transports/sync.rs#L84-L120","documentation":"endpoint.connect(node_id, SYNC_ALPN) failed on the cache-miss path of send_sync_message (transports/sync.rs). Iroh could not resolve or reach the peer NodeId for the sync ALPN within the handshake; the appended text is the underlying iroh error. The failure happens before any connection is cached.","triggerScenarios":"Peer offline or asleep; NodeId stale after peer identity reset; discovery/relay unconfigured or unreachable; NAT traversal failing on both sides; ALPN mismatch from version skew.","commonSituations":"Sync fan-out to devices that went offline; network changes invalidating direct addresses; one-sided upgrades changing SYNC_ALPN.","solutions":["Check device presence before sending and skip offline peers","Verify relay and discovery configuration on both sides","Retry with backoff; transient relay failures clear quickly","Re-pair if the peer generated a new NodeId","Align spacedrive versions so SYNC_ALPN matches"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Best-effort pre-check before the cache-miss connect\nif !device_presence.is_online(device) {\n    return Ok(());\n}\nnet.send_sync_message(device, message).await?;","typeGuard":"fn is_connect_failure(err: &anyhow::Error) -> bool {\n    err.to_string().starts_with(\"Failed to connect to\")\n}","tryCatchPattern":"match net.send_sync_message(device, msg).await {\n    Ok(()) => {}\n    Err(e) if is_connect_failure(&e) => {\n        // transient reachability: bounded backoff retry, then mark device offline\n        mark_device_offline(device);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Keep relay/discovery reachable on both peers","Skip sends to offline devices using presence state","Upgrade devices in lockstep so SYNC_ALPN matches"],"tags":["network","iroh","connectivity","sync","rust"],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}