Email me

Rust errors / Build and Cargo

Rust build error · checked with Rust 1.99.0

cannot start a runtime from within a runtime

Cannot start a runtime from within a runtime. This happens because a function (like `block_on`) attempted to block the current thread while the thread is being used to drive asynchronous tasks.

What it meansYou called block_on (or created a runtime) inside async code that is already running on Tokio. Blocking the runtime's own thread would deadlock, so Tokio panics.

Why it happens

  • Calling a sync wrapper that uses block_on from inside an async fn.
  • Using reqwest::blocking inside async code.

How to fix it

1. Just await it

let data = fetch().await?;

2. Run blocking code on a blocking thread

let out = tokio::task::spawn_blocking(move || heavy_sync_work()).await?;

Other wordings of this error

cannot start a runtime from within a runtime, block_on within runtime panic

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