{"record":{"id":"21e45571c11f865a","repo":"tracel-ai/burn","slug":"can-build-the-burn-remote-blocking-runtime","errorCode":null,"errorMessage":"Can build the Burn Remote blocking runtime","messagePattern":"Can build the Burn Remote blocking runtime","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/burn-remote/src/client/runtime.rs","lineNumber":17,"sourceCode":"//! The client session runtime.\n\n/// Process-global Tokio runtime for sessions opened outside an ambient runtime.\n///\n/// Fallback for synchronous callers (scripts, REPLs, notebooks) and the legacy WebSocket path. A\n/// native Iroh node also binds on this runtime so its endpoint and session tasks share one executor.\n/// When a device is built inside an existing runtime, that one is used instead and this fallback is\n/// never created.\n#[cfg(not(target_family = \"wasm\"))]\npub(crate) fn blocking_runtime() -> &'static tokio::runtime::Runtime {\n    use std::sync::OnceLock;\n    static RUNTIME: OnceLock<tokio::runtime::Runtime> = OnceLock::new();\n    RUNTIME.get_or_init(|| {\n        tokio::runtime::Builder::new_multi_thread()\n            .enable_all()\n            .build()\n            .expect(\"Can build the Burn Remote blocking runtime\")\n    })\n}\n\n/// Executor for a remote session's writer and response-demux tasks.\n///\n/// Captured once at device construction and carried by the device registry, so the session reuses\n/// whatever runtime owns its transport. On native this wraps a Tokio runtime handle: the ambient\n/// runtime if one is active, otherwise the shared [`blocking_runtime`]. In the browser Iroh runs on\n/// the JS event loop; tasks are spawned with `spawn_local` and blocking calls are unavailable.\n#[derive(Clone, Debug)]\npub(crate) enum Executor {\n    #[cfg(not(target_family = \"wasm\"))]\n    Tokio(tokio::runtime::Handle),\n    #[cfg(target_family = \"wasm\")]\n    WasmLocal,\n}\n\n/// Handle to a spawned session task. Joinable on native; a no-op in the browser where tasks","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/tracel-ai/burn/blob/d16f7ba2ed0d41408189384044cc886fb4c8f957/crates/burn-remote/src/client/runtime.rs#L1-L35","documentation":"Initialization guard for the process-global blocking Tokio runtime in burn-remote's client: constructing the fallback runtime (used by synchronous callers and the legacy WebSocket path) failed — typically because a runtime could not be spawned in the current environment (resource limits, restricted threading).","triggerScenarios":"Thrown at crates/burn-remote/src/client/runtime.rs:17 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check for OS thread/resource limits blocking runtime creation","Run within an ambient async runtime instead, which bypasses this fallback","Inspect the environment (e.g., wasm or heavily sandboxed hosts) for tokio compatibility"],"exampleFix":null,"handlingStrategy":"fallback","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"}