Email me

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 -d

Other 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

Up next

Find the right pagePaste any Rust errorCompiler codes and build errors in one finder.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ