{"record":{"id":"21b529766e460cb3","repo":"tracel-ai/burn","slug":"device-registered-with-a-captured-executor","errorCode":null,"errorMessage":"device registered with a captured executor","messagePattern":"device registered with a captured executor","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-remote/src/client/service.rs","lineNumber":87,"sourceCode":"    batch: OutgoingBatch,\n    /// Request-id allocation + the callbacks awaiting response-producing tasks.\n    pending: PendingResponses,\n    /// Emits this device's telemetry (the ops and graphs it sends).\n    probe: TelemetryProbe,\n    /// Shared cell populated from the init handshake (read by `RemoteDevice::defaults`).\n    settings: Arc<OnceLock<DeviceSettings>>,\n    /// Shared cell populated from the init handshake (read by `RemoteDevice::enumerate`).\n    device_count: Arc<OnceLock<u32>>,\n    session_id: SessionId,\n    closed: bool,\n}\n\nimpl DeviceService for RemoteService {\n    fn init(device_id: DeviceId) -> Self {\n        let (id, endpoint, device_index) = Self::resolve_endpoint(device_id);\n        // The executor was captured at device-construction time (in the runtime that owns the\n        // transport) and stored in the registry alongside the endpoint; the service just reuses it.\n        let executor = executor_for(id).expect(\"device registered with a captured executor\");\n        let session_id = SessionId::new();\n\n        let probe = if TelemetryLogger::enabled() {\n            TelemetryProbe::new(CHANNEL_CAPACITY)\n        } else {\n            TelemetryProbe::disabled()\n        };\n        if let Some(task) = logger_task(&probe, MetricSide::Client) {\n            executor.spawn(task);\n        }\n\n        // Lazy connect: `init` must return promptly. cubecl holds a process-global\n        // device-registry lock across this call (to make device-handle creation atomic), so\n        // doing the blocking network connect + handshake here would serialize every remote\n        // device's setup behind that lock — N devices would connect strictly one at a time.\n        // Instead we record the endpoint and open the sockets on the first real use, off the\n        // lock and on the device-runner thread (see `ensure_connected`).\n        Self {","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-remote/src/client/service.rs#L69-L105","documentation":"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.","triggerScenarios":"Thrown at crates/burn-remote/src/client/service.rs:87 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the device/session is created through the normal connect path that captures the executor","Avoid constructing the service manually or before the executor capture","Check for races between service creation and executor initialization"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d16f7ba2ed0d41408189384044cc886fb4c8f957","analyzedAt":"2026-09-05T13:19:14.260Z","contentChangedAt":"2026-09-05T13:19:14.260Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}