{"record":{"id":"08329ab6dba269aa","repo":"spacedriveapp/spacedrive","slug":"networking-endpoint-not-available","errorCode":null,"errorMessage":"Networking endpoint not available","messagePattern":"Networking endpoint not available","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"core/src/ops/files/copy/strategy.rs","lineNumber":486,"sourceCode":"\t\tlet networking_guard = &*networking;\n\n\t\t// Resolve device slug to node_id for network routing\n\t\tlet device_registry = networking_guard.device_registry();\n\t\tlet registry = device_registry.read().await;\n\t\tlet node_id = registry\n\t\t\t.get_node_by_device(source_device_id)\n\t\t\t.ok_or_else(|| {\n\t\t\t\tanyhow::anyhow!(\n\t\t\t\t\t\"Could not find node_id for device {} (slug: {}). Device may be offline.\",\n\t\t\t\t\tsource_device_id,\n\t\t\t\t\tsource_device_slug\n\t\t\t\t)\n\t\t\t})?;\n\t\tdrop(registry);\n\n\t\tlet endpoint = networking_guard\n\t\t\t.endpoint()\n\t\t\t.ok_or_else(|| anyhow::anyhow!(\"Networking endpoint not available\"))?;\n\n\t\tctx.log(format!(\n\t\t\t\"Opening PULL connection to node {} (device {})\",\n\t\t\tnode_id, source_device_id\n\t\t));\n\n\t\t// Connect to remote device\n\t\tlet node_addr = iroh::EndpointAddr::new(node_id);\n\t\tlet connection = endpoint\n\t\t\t.connect(node_addr, b\"spacedrive/filetransfer/1\")\n\t\t\t.await\n\t\t\t.map_err(|e| anyhow::anyhow!(\"Failed to connect to device: {}\", e))?;\n\n\t\tlet (mut send_stream, mut recv_stream) = connection\n\t\t\t.open_bi()\n\t\t\t.await\n\t\t\t.map_err(|e| anyhow::anyhow!(\"Failed to open bidirectional stream: {}\", e))?;\n","sourceCodeStart":468,"sourceCodeEnd":504,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/core/src/ops/files/copy/strategy.rs#L468-L504","documentation":"networking_guard.endpoint() (core/src/service/network/core/mod.rs:947) returns the iroh Endpoint only when the networking service has created and retained one. None here means the service object exists but its endpoint was never bound or was torn down — partial startup, a shutdown race, or an endpoint-less configuration. The job stops before attempting any connection (strategy.rs:484-486).","triggerScenarios":"Copy job starts during networking shutdown or before endpoint binding completes; endpoint creation failed earlier with the error swallowed; a test NetworkingService constructed without an endpoint.","commonSituations":"Daemon restart races where in-flight jobs outlive networking shutdown; config that disables the iroh endpoint; init errors logged but not propagated.","solutions":["Restart the daemon so networking and its endpoint initialize before jobs run","Check startup logs for iroh endpoint binding failures","Cancel or re-queue copy jobs when the networking service shuts down","Verify the networking configuration enables the iroh endpoint"],"exampleFix":"// before\nlet endpoint = networking_guard.endpoint()\n    .ok_or_else(|| anyhow::anyhow!(\"Networking endpoint not available\"))?;\n\n// after: fail with actionable context\nlet endpoint = networking_guard.endpoint().ok_or_else(|| anyhow::anyhow!(\n    \"iroh endpoint not bound; networking service is starting up or shutting down\"\n))?;","handlingStrategy":"validation","validationCode":"let ready = ctx\n    .networking_service()\n    .map(|n| n.endpoint().is_some())\n    .unwrap_or(false);\nif !ready {\n    return Err(anyhow::anyhow!(\"iroh endpoint not bound; networking still starting or shutting down\"));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Wait for networking readiness (endpoint bound) before dispatching remote jobs","Cancel in-flight remote jobs on daemon shutdown instead of letting them hit a torn-down endpoint","Monitor endpoint binding at startup and fail fast with a clear error"],"tags":["rust","spacedrive","pull","networking","iroh","endpoint","lifecycle"],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}