spacedriveapp/spacedrive · error · anyhow::Error
Networking service not available
Error message
Networking service not available
What it means
execute_push requires the NetworkingService via ctx.networking_service() (core/src/infra/job/context.rs:53), which returns Some only when the JobContext was constructed with an Arc<NetworkingService>. None means the daemon, harness, or test that built the job context has no networking service attached, so no remote PUSH can be orchestrated.
Source
Thrown at core/src/ops/files/copy/strategy.rs:317
})?;
let library = ctx.library();
let dest_device_id = library
.resolve_device_slug(dest_device_slug)
.ok_or_else(|| anyhow::anyhow!(
"Could not resolve destination device slug '{}' to UUID in library {}. Device may not be registered in this library.",
dest_device_slug,
library.id()
))?;
debug!(
"RemoteTransferStrategy PUSH: {} -> device:{} ({})",
source, dest_device_slug, dest_device_id
);
let networking = ctx
.networking_service()
.ok_or_else(|| anyhow::anyhow!("Networking service not available"))?;
let local_path = source
.as_local_path()
.ok_or_else(|| anyhow::anyhow!("Source must be local path for PUSH operation"))?;
let metadata = tokio::fs::metadata(local_path).await?;
let file_size = metadata.len();
let checksum = calculate_file_checksum(local_path)
.await
.map(Some)
.map_err(|e| anyhow::anyhow!("Failed to calculate checksum: {}", e))?;
info!(
"Initiating PUSH transfer: {} ({} bytes) -> device:{} ({})",
local_path.display(),
file_size,
dest_device_slug,View on GitHub (pinned to 6dfeccf211)
Solutions
- Enable/initialize the NetworkingService and restart the daemon (cargo run --bin sd-cli -- restart)
- Ensure the JobContext is built after networking startup so the Arc is passed in
- If networking is genuinely absent, route the copy through LocalTransferStrategy instead of RemoteTransferStrategy
- In tests, inject a NetworkingService (or mock) into the JobContext
Example fix
// before
let bytes = remote_strategy.execute(ctx, &src, &dst).await?; // "Networking service not available"
// after
let bytes = if ctx.networking_service().is_some() {
remote_strategy.execute(ctx, &src, &dst).await?
} else {
local_strategy.execute(ctx, &src, &dst).await?
}; Defensive patterns
Strategy: fallback
Validate before calling
if ctx.networking_service().is_none() {
// choose local strategy or queue the job for later
return local_strategy.execute(ctx, &src, &dst).await;
} Try / catch
match remote_strategy.execute(ctx, &src, &dst).await {
Ok(n) => Ok(n),
Err(e) if e.to_string().contains("Networking service not available") => {
tracing::warn!(%e, "networking unavailable; falling back to local copy");
local_strategy.execute(ctx, &src, &dst).await
}
Err(e) => Err(e),
} Prevention
- Initialize the NetworkingService before constructing JobContexts that run copy jobs
- Check ctx.networking_service().is_some() at job dispatch, not deep in the strategy
- Queue remote jobs for retry when the daemon starts with networking disabled
When it happens
Trigger: Running the copy from a JobContext built without networking: daemon started with networking disabled or not yet initialized, an init-order bug dispatching jobs before NetworkingService spawns, or unit tests constructing a minimal JobContext.
Common situations: Networking feature disabled at daemon startup; service initialization ordering bug; integration tests reusing a JobContext fixture without the networking field populated.
Related errors
- Could not resolve destination device slug '{}' to UUID in li
- Source must be local path for PUSH operation
- File transfer protocol not registered
- Failed to calculate checksum: {}
- Invalid file transfer protocol handler
AI-assisted analysis of spacedriveapp/spacedrive@6dfeccf211 (2026-08-16).
Data as JSON: /api/errors/bc122dd193abe21e.
Report an issue: GitHub.