DioxusLabs/dioxus · error

Lazy initialization is only supported with tokio and…

Error message

Lazy initialization is only supported with tokio and threads enabled.

What it means

Lazy::blocking_initialize was called on a target where neither tokio nor thread support is compiled in (e.g. embedded or restricted wasm builds). Blocking initialization needs a runtime to poll the future, so unsupported configurations hit this guard.

Solutions

  1. Lazy initialization requires tokio with threads. Enable a multi-threaded tokio runtime.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/fullstack/src/lazy.rs:165 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of DioxusLabs/dioxus@24f6a829df (2026-08-23). Data as JSON: /api/errors/a844414b38e6cd39. Report an issue: GitHub.

Appendix: source

Thrown at packages/fullstack/src/lazy.rs:165

    {
        let ptr: F = unsafe { std::mem::zeroed() };
        let fut = ptr();
        return std::thread::spawn(move || {
            tokio::runtime::Builder::new_current_thread()
                .enable_all()
                .build()
                .unwrap()
                .block_on(fut)
                .map_err(|e| e.into())
        })
        .join()
        .unwrap();
    }

    // todo: technically we can support constructors in wasm with the same tricks inventory uses with `__wasm_call_ctors`
    // the host would need to decide when to cal the ctors and when to block them.
    #[cfg(not(feature = "server"))]
    unimplemented!("Lazy initialization is only supported with tokio and threads enabled.")
}

View on GitHub (pinned to 24f6a829df)