tokio-rs/tokio · error · syn::Error

No such runtime flavor `{s}`. The runtime flavors are `curre

Error message

No such runtime flavor `{s}`. The runtime flavors are `current_thread`, `local`, and `multi_thread`.

What it means

`RuntimeFlavor::from_str` (entry.rs:25) is the catch-all for any `flavor` value that is not one of `current_thread`, `local`, or `multi_thread` and is not a recognized legacy alias. It formats the offending value into the message.

Source

Thrown at tokio-macros/src/entry.rs:25

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

  1. Use one of the supported flavors: `current_thread`, `local`, or `multi_thread`.
  2. If you wanted the single-threaded runtime, use `current_thread`.
  3. Remove the `flavor` option entirely to accept the documented default (`multi_thread` when `rt-multi-thread` is on, else `current_thread`).

Example fix

// before
#[tokio::main(flavor = "multithread")]
async fn main() {}

// after
#[tokio::main(flavor = "multi_thread")]
async fn main() {}
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Typing an arbitrary/misspelled flavor such as `#[tokio::main(flavor = "multithread")]`, `flavor = "single"`, or an unsupported runtime name.

Common situations: Typos; wrong-case (`Multi_Thread`); assuming a flavor that doesn't exist; mixing in names from other runtimes.

Related errors


AI-assisted analysis of tokio-rs/tokio@625954f365 (2026-08-11). Data as JSON: /api/errors/a22a665a2380c180. Report an issue: GitHub.