tracel-ai/burn · error

Can build the Burn Remote blocking runtime

Error message

Can build the Burn Remote blocking runtime

What it means

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).

Source

Thrown at crates/burn-remote/src/client/runtime.rs:17

//! The client session runtime.

/// Process-global Tokio runtime for sessions opened outside an ambient runtime.
///
/// Fallback for synchronous callers (scripts, REPLs, notebooks) and the legacy WebSocket path. A
/// native Iroh node also binds on this runtime so its endpoint and session tasks share one executor.
/// When a device is built inside an existing runtime, that one is used instead and this fallback is
/// never created.
#[cfg(not(target_family = "wasm"))]
pub(crate) fn blocking_runtime() -> &'static tokio::runtime::Runtime {
    use std::sync::OnceLock;
    static RUNTIME: OnceLock<tokio::runtime::Runtime> = OnceLock::new();
    RUNTIME.get_or_init(|| {
        tokio::runtime::Builder::new_multi_thread()
            .enable_all()
            .build()
            .expect("Can build the Burn Remote blocking runtime")
    })
}

/// Executor for a remote session's writer and response-demux tasks.
///
/// Captured once at device construction and carried by the device registry, so the session reuses
/// whatever runtime owns its transport. On native this wraps a Tokio runtime handle: the ambient
/// runtime if one is active, otherwise the shared [`blocking_runtime`]. In the browser Iroh runs on
/// the JS event loop; tasks are spawned with `spawn_local` and blocking calls are unavailable.
#[derive(Clone, Debug)]
pub(crate) enum Executor {
    #[cfg(not(target_family = "wasm"))]
    Tokio(tokio::runtime::Handle),
    #[cfg(target_family = "wasm")]
    WasmLocal,
}

/// Handle to a spawned session task. Joinable on native; a no-op in the browser where tasks

View on GitHub (pinned to d16f7ba2ed)

Solutions

  1. Check for OS thread/resource limits blocking runtime creation
  2. Run within an ambient async runtime instead, which bypasses this fallback
  3. Inspect the environment (e.g., wasm or heavily sandboxed hosts) for tokio compatibility
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/burn-remote/src/client/runtime.rs:17 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/21e45571c11f865a. Report an issue: GitHub.