{"record":{"id":"bc122dd193abe21e","repo":"spacedriveapp/spacedrive","slug":"networking-service-not-available","errorCode":null,"errorMessage":"Networking service not available","messagePattern":"Networking service not available","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"core/src/ops/files/copy/strategy.rs","lineNumber":317,"sourceCode":"\t\t})?;\n\n\t\tlet library = ctx.library();\n\t\tlet dest_device_id = library\n\t\t\t.resolve_device_slug(dest_device_slug)\n\t\t\t.ok_or_else(|| anyhow::anyhow!(\n\t\t\t\t\"Could not resolve destination device slug '{}' to UUID in library {}. Device may not be registered in this library.\",\n\t\t\t\tdest_device_slug,\n\t\t\t\tlibrary.id()\n\t\t\t))?;\n\n\t\tdebug!(\n\t\t\t\"RemoteTransferStrategy PUSH: {} -> device:{} ({})\",\n\t\t\tsource, dest_device_slug, dest_device_id\n\t\t);\n\n\t\tlet networking = ctx\n\t\t\t.networking_service()\n\t\t\t.ok_or_else(|| anyhow::anyhow!(\"Networking service not available\"))?;\n\n\t\tlet local_path = source\n\t\t\t.as_local_path()\n\t\t\t.ok_or_else(|| anyhow::anyhow!(\"Source must be local path for PUSH operation\"))?;\n\n\t\tlet metadata = tokio::fs::metadata(local_path).await?;\n\t\tlet file_size = metadata.len();\n\n\t\tlet checksum = calculate_file_checksum(local_path)\n\t\t\t.await\n\t\t\t.map(Some)\n\t\t\t.map_err(|e| anyhow::anyhow!(\"Failed to calculate checksum: {}\", e))?;\n\n\t\tinfo!(\n\t\t\t\"Initiating PUSH transfer: {} ({} bytes) -> device:{} ({})\",\n\t\t\tlocal_path.display(),\n\t\t\tfile_size,\n\t\t\tdest_device_slug,","sourceCodeStart":299,"sourceCodeEnd":335,"githubUrl":"https://github.com/spacedriveapp/spacedrive/blob/6dfeccf2113039e35f2ce735f945e70dc3e4ea45/core/src/ops/files/copy/strategy.rs#L299-L335","documentation":"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.","triggerScenarios":"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.","commonSituations":"Networking feature disabled at daemon startup; service initialization ordering bug; integration tests reusing a JobContext fixture without the networking field populated.","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"],"exampleFix":"// before\nlet bytes = remote_strategy.execute(ctx, &src, &dst).await?; // \"Networking service not available\"\n\n// after\nlet bytes = if ctx.networking_service().is_some() {\n    remote_strategy.execute(ctx, &src, &dst).await?\n} else {\n    local_strategy.execute(ctx, &src, &dst).await?\n};","handlingStrategy":"fallback","validationCode":"if ctx.networking_service().is_none() {\n    // choose local strategy or queue the job for later\n    return local_strategy.execute(ctx, &src, &dst).await;\n}","typeGuard":null,"tryCatchPattern":"match remote_strategy.execute(ctx, &src, &dst).await {\n    Ok(n) => Ok(n),\n    Err(e) if e.to_string().contains(\"Networking service not available\") => {\n        tracing::warn!(%e, \"networking unavailable; falling back to local copy\");\n        local_strategy.execute(ctx, &src, &dst).await\n    }\n    Err(e) => Err(e),\n}","preventionTips":["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"],"tags":["rust","spacedrive","push","networking","service-availability","copy"],"backgroundTag":null,"analyzedSha":"6dfeccf2113039e35f2ce735f945e70dc3e4ea45","analyzedAt":"2026-08-16T11:26:17.074Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}