spacedriveapp/spacedrive · error · anyhow::Error

Could not find node_id for device {} (slug: {}). Device may

Error message

Could not find node_id for device {} (slug: {}). Device may be offline.

What it means

After resolving the source UUID, execute_pull maps it to an iroh EndpointId via DeviceRegistry::get_node_by_device (core/src/service/network/device/registry.rs:626). None means this daemon currently has no known live node for that device — the peer is offline, not yet discovered, or its node entry expired. The message itself hints 'Device may be offline.'

Source

Thrown at core/src/ops/files/copy/strategy.rs:476

			"Initiating PULL transfer: device:{}:{} -> {}",
			source_device_slug,
			source_path.display(),
			local_dest_path.display()
		));

		let networking = ctx
			.networking_service()
			.ok_or_else(|| anyhow::anyhow!("Networking service not available"))?;

		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);

View on GitHub (pinned to 6dfeccf211)

Solutions

  1. Verify the device is online (network status / device list query) and re-run the copy
  2. Ensure discovery and pairing completed so the device registry holds a node for the UUID
  3. Retry with backoff — the registry repopulates as soon as the peer reconnects
  4. Check relay/connectivity settings if the peer should currently be reachable

Example fix

// before
remote_strategy.execute_pull(ctx, &src, &dst).await?; // "Could not find node_id ... Device may be offline."

// after: bounded wait for the peer to register
let networking = ctx.networking_service().ok_or_else(|| anyhow::anyhow!("no networking"))?;
let registry = networking.device_registry();
for attempt in 0..5 {
    if registry.read().await.get_node_by_device(device_id).is_some() {
        break;
    }
    tokio::time::sleep(std::time::Duration::from_secs(1u64 << attempt)).await;
}
remote_strategy.execute_pull(ctx, &src, &dst).await?;
Defensive patterns

Strategy: retry

Validate before calling

let networking = ctx.networking_service().ok_or_else(|| anyhow::anyhow!("no networking"))?;
let registry = networking.device_registry();
if registry.read().await.get_node_by_device(device_id).is_none() {
    return Err(anyhow::anyhow!("device {} has no live node; likely offline — retry when online", device_id));
}

Try / catch

match remote_strategy.execute_pull(ctx, &src, &dst).await {
    Ok(n) => Ok(n),
    Err(e) if e.to_string().contains("Device may be offline") => {
        schedule_retry_with_backoff(job_id, 5).await;
        Err(e)
    }
    Err(e) => Err(e),
}

Prevention

When it happens

Trigger: Peer device offline or asleep when the job runs; discovery/pairing incomplete so no node exists for the UUID; node entry evicted after prolonged disconnection; job retried after a network flap before the registry re-registers the node.

Common situations: Scheduled sync jobs firing while the peer laptop is closed; devices on separate networks with no relay path; race between pairing completion and node registration.

Related errors


AI-assisted analysis of spacedriveapp/spacedrive@6dfeccf211 (2026-08-16). Data as JSON: /api/errors/bdbed639a8d22262. Report an issue: GitHub.