tracel-ai/burn · error

Remote service has not connected to this device yet

Error message

Remote service has not connected to this device yet

What it means

This panic means the burn-remote client registry holds no DeviceSettings OnceLock for the requested device id, i.e. the remote service never published settings for it. settings_for unwraps the OnceLock and panics if it is still empty.

Source

Thrown at crates/burn-remote/src/client/service/registry.rs:103

        .by_index
        .get(&id)
        .map(|entry| (entry.endpoint.clone(), entry.device_index))
}

/// The runtime captured for `id`'s device at construction, used to drive its session tasks.
pub(crate) fn executor_for(id: u32) -> Option<Executor> {
    registry()
        .lock()
        .unwrap()
        .by_index
        .get(&id)
        .map(|entry| entry.executor.clone())
}

pub(crate) fn settings_for(id: u32) -> DeviceSettings {
    *settings_cell(id)
        .get()
        .expect("Remote service has not connected to this device yet")
}

pub(crate) fn has_settings(id: u32) -> bool {
    registry()
        .lock()
        .unwrap()
        .by_index
        .get(&id)
        .is_some_and(|entry| entry.settings.get().is_some())
}

pub(crate) fn settings_cell(id: u32) -> Arc<OnceLock<DeviceSettings>> {
    registry()
        .lock()
        .unwrap()
        .by_index
        .get(&id)
        .expect("Device id not registered")

View on GitHub (pinned to d16f7ba2ed)

Solutions

  1. Ensure the client has fully connected (and the service has registered the device) before calling settings_for
  2. Verify the device id is one the remote service actually exposes (check registry with has_settings)
  3. Check server logs for failed startup/handshake that would prevent settings publication
  4. Retry after connection is established rather than calling settings_for eagerly

Example fix

// before
let settings = settings_for(device_id);
// after
if !has_settings(device_id) {
    // wait for connection / register the device first
}
let settings = settings_for(device_id);
Defensive patterns

Strategy: validation

Validate before calling

if !registry::has_settings(device_id) {
    // wait for connection / register the device before proceeding
    return Err(anyhow!("settings for device {device_id} not yet available"));
}
let settings = registry::settings_for(device_id);

Try / catch

let settings = std::panic::catch_unwind(|| registry::settings_for(device_id))
    .map_err(|_| anyhow!("remote service not connected for device {device_id}"))?;

Prevention

When it happens

Trigger: Calling settings_for(id) (directly or via client setup paths) before the remote service connection handshake has populated settings for that device id, or with an id that the service never registered.

Common situations: Querying device settings immediately after creating a client without awaiting connection; device id mismatch between client and server; server crashed before advertising settings.

Related errors


AI-assisted analysis of tracel-ai/burn@d16f7ba2ed (2026-09-05). Data as JSON: /api/errors/ca0cf73939da7fe8. Report an issue: GitHub.