spacedriveapp/spacedrive · error · anyhow::Error

Could not find node_id for device {}

Error message

Could not find node_id for device {}

What it means

Before dialing, the sender maps the destination device UUID to an Iroh node_id via the networking device registry; get_node_by_device returned None. Without a node_id no connection can be routed, so the transfer aborts before connecting. The registry only knows devices that have connected since the networking layer came up, so a missing entry means unknown or stale device state.

Source

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

	debug!(
		"Streaming {} bytes to device {}",
		total_size, destination_device_id
	);

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

	let networking_guard = &*networking;

	// Map device UUID to Iroh 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(destination_device_id)
		.ok_or_else(|| {
			anyhow::anyhow!(
				"Could not find node_id for device {}",
				destination_device_id
			)
		})?;
	drop(registry);

	let endpoint = networking_guard
		.endpoint()
		.ok_or_else(|| anyhow::anyhow!("Networking endpoint not available"))?;

	ctx.log(format!(
		"Opening persistent connection to node {} (device {}) for file transfer",
		node_id, destination_device_id
	));

	let node_addr = iroh::EndpointAddr::new(node_id);
	let connection = endpoint
		.connect(node_addr, b"spacedrive/filetransfer/1")

View on GitHub (pinned to 6dfeccf211)

Solutions

  1. Bring the target device online once so the registry records its node_id, then retry
  2. Re-pair the target device if it was reinstalled or re-keyed
  3. Verify destination_device_id still matches a live device in the library's device table
  4. Restart both daemons to force registry re-registration
Defensive patterns

Strategy: validation

Validate before calling

// Resolve routing before starting the transfer.
let networking = ctx.networking_service().context("networking required")?;
let registry = networking.device_registry().read().await;
if registry.get_node_by_device(destination_device_id).is_none() {
    anyhow::bail!(
        "Device {} is unknown to the network registry - bring it online first",
        destination_device_id
    );
}
drop(registry);

Prevention

When it happens

Trigger: Target device has never connected since networking was enabled; stale device rows in the library database referencing pre-networking installs; device was removed but is still referenced by the copy job; registry not yet populated at job dispatch time.

Common situations: Fresh installs where old devices appear in the library but have not reconnected, peer reinstalled or re-keyed (new node_id), jobs persisted from before a re-pair.

Related errors


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