spacedriveapp/spacedrive · error · anyhow::Error
Networking endpoint not available
Error message
Networking endpoint not available
What it means
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).
Source
Thrown at core/src/ops/files/copy/strategy.rs:486
let networking_guard = &*networking;
// Resolve device slug to node_id for network routing
let device_registry = networking_guard.device_registry();
let registry = device_registry.read().await;
let node_id = registry
.get_node_by_device(source_device_id)
.ok_or_else(|| {
anyhow::anyhow!(
"Could not find node_id for device {} (slug: {}). Device may be offline.",
source_device_id,
source_device_slug
)
})?;
drop(registry);
let endpoint = networking_guard
.endpoint()
.ok_or_else(|| anyhow::anyhow!("Networking endpoint not available"))?;
ctx.log(format!(
"Opening PULL connection to node {} (device {})",
node_id, source_device_id
));
// Connect to remote device
let node_addr = iroh::EndpointAddr::new(node_id);
let connection = endpoint
.connect(node_addr, b"spacedrive/filetransfer/1")
.await
.map_err(|e| anyhow::anyhow!("Failed to connect to device: {}", e))?;
let (mut send_stream, mut recv_stream) = connection
.open_bi()
.await
.map_err(|e| anyhow::anyhow!("Failed to open bidirectional stream: {}", e))?;
View on GitHub (pinned to 6dfeccf211)
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
Example fix
// before
let endpoint = networking_guard.endpoint()
.ok_or_else(|| anyhow::anyhow!("Networking endpoint not available"))?;
// after: fail with actionable context
let endpoint = networking_guard.endpoint().ok_or_else(|| anyhow::anyhow!(
"iroh endpoint not bound; networking service is starting up or shutting down"
))?; Defensive patterns
Strategy: validation
Validate before calling
let ready = ctx
.networking_service()
.map(|n| n.endpoint().is_some())
.unwrap_or(false);
if !ready {
return Err(anyhow::anyhow!("iroh endpoint not bound; networking still starting or shutting down"));
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Daemon restart races where in-flight jobs outlive networking shutdown; config that disables the iroh endpoint; init errors logged but not propagated.
Related errors
- Could not find node_id for device {} (slug: {}). Device may
- Failed to connect to device: {}
- Failed to open bidirectional stream: {}
- Networking service not available
- File transfer protocol not registered
AI-assisted analysis of spacedriveapp/spacedrive@6dfeccf211 (2026-08-16).
Data as JSON: /api/errors/08329ab6dba269aa.
Report an issue: GitHub.