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

The `basic_scheduler` runtime flavor has been renamed to `cu

Error message

The `basic_scheduler` runtime flavor has been renamed to `current_thread`.

What it means

`RuntimeFlavor::from_str` (entry.rs:23) recognizes the old tokio pre-1.0 name `basic_scheduler` only to emit this rename notice. It is no longer a valid flavor; the replacement is `current_thread`.

Source

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

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

  1. Replace `flavor = "basic_scheduler"` with `flavor = "current_thread"`.
  2. Audit the whole crate for other legacy names (`threaded_scheduler` → `multi_thread`) when migrating from 0.x.

Example fix

// before (tokio 0.x)
#[tokio::main(basic_scheduler)]
async fn main() {}

// after (tokio 1.x)
#[tokio::main(flavor = "current_thread")]
async fn main() {}
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Using `#[tokio::main(flavor = "basic_scheduler")]` carried over from an old tokio version (0.x).

Common situations: Upgrading a crate from tokio 0.2/0.3 to 1.x without updating macro options; copy-pasting from pre-1.0 docs/examples.

Related errors


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