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