tracel-ai/burn · error

Cannot host a remote server on a remote device

Error message

Cannot host a remote server on a remote device

What it means

This panic occurs when attempting to host a burn remote server on a device that is itself a Remote device. A remote server must execute ops on a real local backend (one with BackendIr); hosting on a remote device would create a server that forwards to another server, which is unsupported and would cause infinite forwarding.

Source

Thrown at crates/burn-dispatch/src/remote_server.rs:101

            #[cfg(any(feature = "flex", default_backend))]
            DispatchDevice::Flex(_) => {
                type $b = Flex;
                let $devices = host_devices!(DispatchDeviceId::Flex, Flex);
                $body
            }
            #[cfg(feature = "ndarray")]
            DispatchDevice::NdArray(_) => {
                type $b = NdArray;
                let $devices = host_devices!(DispatchDeviceId::NdArray, NdArray);
                $body
            }
            #[cfg(feature = "tch")]
            DispatchDevice::LibTorch(_) => {
                panic!("LibTorch is not supported as a remote-server backend (no BackendIr impl)")
            }
            #[cfg(feature = "remote")]
            DispatchDevice::Remote(_) => {
                panic!("Cannot host a remote server on a remote device")
            }
            #[cfg(feature = "capture")]
            DispatchDevice::Capture(_) => {
                panic!("Cannot host a remote server on a capture device")
            }
            #[cfg(feature = "autodiff")]
            DispatchDevice::Autodiff(_) => {
                unreachable!("Autodiff stripped by .inner() above")
            }
        }
    };
}

/// Start a remote-execution server for `device`'s backend, blocking the current thread.
///
/// `device` selects the backend; `channel` selects the transport. The server hosts that backend's
/// devices, indexed by hardware device index. Use [`start_async`] for the async counterpart.
#[cfg(not(target_family = "wasm"))]

View on GitHub (pinned to d16f7ba2ed)

Solutions

  1. Point the server's host device at a local backend device (e.g., DispatchDevice::NdArray).
  2. Do not enable the `remote` device as the hosting device; remove remote device entries from the server config.
  3. If nesting is needed, host the second server on a real backend and have clients choose which server to contact, rather than chaining servers.

Example fix

// before (server config reusing client device)
let device = DispatchDevice::Remote(remote_client);
// after
let device = DispatchDevice::NdArray(ndarray_device);
Defensive patterns

Strategy: validation

Validate before calling

match device {
    DispatchDevice::Remote(_) => return Err("cannot host a remote server on a remote device".into()),
    _ => {}
}

Type guard

fn is_local_device(d: &DispatchDevice) -> bool {
    !matches!(d, DispatchDevice::Remote(_))
}

Prevention

When it happens

Trigger: Starting a remote server with DispatchDevice::Remote(_) as the host device (feature "remote" enabled and the server's device resolved to a remote client device).

Common situations: Reusing a client-side configuration (pointing at a remote server) for the server binary; miswired device resolution where host_devices! picks up the client's remote device instead of a local one.

Related errors


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