tokio-rs/tokio · error · syn::Error
The `threaded_scheduler` runtime flavor has been renamed to
Error message
The `threaded_scheduler` runtime flavor has been renamed to `multi_thread`.
What it means
`RuntimeFlavor::from_str` (entry.rs:24) keeps the pre-1.0 name `threaded_scheduler` only to redirect users. The current multi-threaded flavor is `multi_thread`.
Source
Thrown at tokio-macros/src/entry.rs:24
// syn::AttributeArgs does not implement syn::Parse
type AttributeArgs = syn::punctuated::Punctuated<syn::Meta, syn::Token![,]>;
#[derive(Clone, Copy, PartialEq)]
enum RuntimeFlavor {
CurrentThread,
Threaded,
Local,
}
impl RuntimeFlavor {
fn from_str(s: &str) -> Result<RuntimeFlavor, String> {
match s {
"current_thread" => Ok(RuntimeFlavor::CurrentThread),
"multi_thread" => Ok(RuntimeFlavor::Threaded),
"local" => Ok(RuntimeFlavor::Local),
"single_thread" => Err("The single threaded runtime flavor is called `current_thread`.".to_string()),
"basic_scheduler" => Err("The `basic_scheduler` runtime flavor has been renamed to `current_thread`.".to_string()),
"threaded_scheduler" => Err("The `threaded_scheduler` runtime flavor has been renamed to `multi_thread`.".to_string()),
_ => Err(format!("No such runtime flavor `{s}`. The runtime flavors are `current_thread`, `local`, and `multi_thread`.")),
}
}
}
#[derive(Clone, Copy, PartialEq)]
enum UnhandledPanic {
Ignore,
ShutdownRuntime,
}
impl UnhandledPanic {
fn from_str(s: &str) -> Result<UnhandledPanic, String> {
match s {
"ignore" => Ok(UnhandledPanic::Ignore),
"shutdown_runtime" => Ok(UnhandledPanic::ShutdownRuntime),
_ => Err(format!("No such unhandled panic behavior `{s}`. The unhandled panic behaviors are `ignore` and `shutdown_runtime`.")),
}View on GitHub (pinned to 625954f365)
Solutions
- Replace `flavor = "threaded_scheduler"` with `flavor = "multi_thread"`.
- Ensure the `rt-multi-thread` feature is enabled in `Cargo.toml` (required for the multi-thread flavor).
Example fix
// before (tokio 0.x)
#[tokio::main(threaded_scheduler)]
async fn main() {}
// after (tokio 1.x)
#[tokio::main(flavor = "multi_thread")]
async fn main() {} Defensive patterns
Strategy: validation
Prevention
- On tokio 0.x → 1.x migration, replace `threaded_scheduler` with `multi_thread`.
- Confirm `rt-multi-thread` is enabled in `Cargo.toml` for the multi-thread flavor.
- Update any copied example code to current option names.
When it happens
Trigger: Using `#[tokio::main(flavor = "threaded_scheduler")]` from old tokio code.
Common situations: Migrating from tokio 0.x; stale Stack Overflow answers / blog posts.
Related errors
- The `basic_scheduler` runtime flavor has been renamed to `cu
- The single threaded runtime flavor is called `current_thread
- `name` set multiple times.
- `flavor` set multiple times.
- No such runtime flavor `{s}`. The runtime flavors are `curre
AI-assisted analysis of tokio-rs/tokio@625954f365 (2026-08-11).
Data as JSON: /api/errors/d7053367f48b7241.
Report an issue: GitHub.