Rust errors / Build and Cargo
Rust build error · checked with Rust 1.99.0
there is no reactor running, must be called from the context of a Tokio 1.x runtime
there is no reactor running, must be called from the context of a Tokio 1.x runtime
What it meansA Tokio-based function ran outside a Tokio runtime: from a plain thread, from a different async runtime, or before the runtime started. It panics at run time, not at compile time.
Why it happens
- Calling tokio code from std::thread::spawn or a sync callback.
- Mixing runtimes (async-std, smol, actix-rt older versions) with tokio-only crates.
- Two different major versions of tokio in the tree.
How to fix it
1. Start a runtime
#[tokio::main]
async fn main() { run().await; }2. From sync code, enter the runtime you have
let rt = tokio::runtime::Runtime::new()?;
rt.block_on(async { do_work().await });3. Check for two tokio versions
cargo tree -i tokio -dOther wordings of this error
there is no reactor running, must be called from the context of a Tokio 1.x runtime, no reactor running, must be called from the context of a Tokio
Other build errors
- error: linker `link.exe` not found
- error: linker `cc` not found
- error: failed to run custom build command for `openssl-sys`
- error: failed to select a version for the requirement
- error: failed to select a version for `libsqlite3-sys`... the package `libsqlite3-sys` lin
- error: could not compile `my-crate` (bin "my-crate") due to 1 previous error
- error: package `foo v1.2.3` cannot be built because it requires rustc 1.80 or newer, while
- feature `edition2024` is required
Up next
Find the right pagePaste any Rust errorCompiler codes and build errors in one finder.Read it next →Also worth your time
Did this answer your question?