tracel-ai/burn · error

device registered with a captured executor

Error message

device registered with a captured executor

What it means

Initialization invariant in `RemoteService::init`: the device's executor was expected to be captured during session setup (used to spawn response-producing tasks), but the capture cell is empty when init runs, so the service panics rather than operate without an executor.

Source

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

    batch: OutgoingBatch,
    /// Request-id allocation + the callbacks awaiting response-producing tasks.
    pending: PendingResponses,
    /// Emits this device's telemetry (the ops and graphs it sends).
    probe: TelemetryProbe,
    /// Shared cell populated from the init handshake (read by `RemoteDevice::defaults`).
    settings: Arc<OnceLock<DeviceSettings>>,
    /// Shared cell populated from the init handshake (read by `RemoteDevice::enumerate`).
    device_count: Arc<OnceLock<u32>>,
    session_id: SessionId,
    closed: bool,
}

impl DeviceService for RemoteService {
    fn init(device_id: DeviceId) -> Self {
        let (id, endpoint, device_index) = Self::resolve_endpoint(device_id);
        // The executor was captured at device-construction time (in the runtime that owns the
        // transport) and stored in the registry alongside the endpoint; the service just reuses it.
        let executor = executor_for(id).expect("device registered with a captured executor");
        let session_id = SessionId::new();

        let probe = if TelemetryLogger::enabled() {
            TelemetryProbe::new(CHANNEL_CAPACITY)
        } else {
            TelemetryProbe::disabled()
        };
        if let Some(task) = logger_task(&probe, MetricSide::Client) {
            executor.spawn(task);
        }

        // Lazy connect: `init` must return promptly. cubecl holds a process-global
        // device-registry lock across this call (to make device-handle creation atomic), so
        // doing the blocking network connect + handshake here would serialize every remote
        // device's setup behind that lock — N devices would connect strictly one at a time.
        // Instead we record the endpoint and open the sockets on the first real use, off the
        // lock and on the device-runner thread (see `ensure_connected`).
        Self {

View on GitHub (pinned to d16f7ba2ed)

Solutions

  1. Ensure the device/session is created through the normal connect path that captures the executor
  2. Avoid constructing the service manually or before the executor capture
  3. Check for races between service creation and executor initialization
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/burn-remote/src/client/service.rs:87 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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