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

The `start_paused` option requires the `current_thread` runt

Error message

The `start_paused` option requires the `current_thread` runtime flavor. Use `#[{}(flavor = "current_thread")]`

What it means

In `build` (entry.rs:221), `start_paused` (the auto-advancing test clock) is only supported by the `current_thread` runtime. Combining it with `flavor = "multi_thread"` is rejected with guidance to switch flavor.

Source

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

            }
            (F::CurrentThread | F::Local, None) => None,
            (F::Threaded, worker_threads) if self.rt_multi_thread_available => {
                worker_threads.map(|(val, _span)| val)
            }
            (F::Threaded, _) => {
                let msg = if self.flavor.is_none() {
                    "The default runtime flavor is `multi_thread`, but the `rt-multi-thread` feature is disabled."
                } else {
                    "The runtime flavor `multi_thread` requires the `rt-multi-thread` feature."
                };
                return Err(syn::Error::new(Span::call_site(), msg));
            }
        };

        let start_paused = match (flavor, self.start_paused) {
            (F::Threaded, Some((_, start_paused_span))) => {
                let msg = format!(
                    "The `start_paused` option requires the `current_thread` runtime flavor. Use `#[{}(flavor = \"current_thread\")]`",
                    self.macro_name(),
                );
                return Err(syn::Error::new(start_paused_span, msg));
            }
            (F::CurrentThread | F::Local, Some((start_paused, _))) => Some(start_paused),
            (_, None) => None,
        };

        let unhandled_panic = match (flavor, self.unhandled_panic) {
            (F::Threaded, Some((_, unhandled_panic_span))) => {
                let msg = format!(
                    "The `unhandled_panic` option requires the `current_thread` runtime flavor. Use `#[{}(flavor = \"current_thread\")]`",
                    self.macro_name(),
                );
                return Err(syn::Error::new(unhandled_panic_span, msg));
            }
            (F::CurrentThread | F::Local, Some((unhandled_panic, _))) => Some(unhandled_panic),
            (_, None) => None,

View on GitHub (pinned to 625954f365)

Solutions

  1. Switch the flavor to `current_thread`: `#[tokio::test(flavor = "current_thread", start_paused = true)]`.
  2. Or remove `start_paused` if you must keep the multi-thread flavor.

Example fix

// before
#[tokio::test(flavor = "multi_thread", start_paused = true)]
async fn t() {}

// after
#[tokio::test(flavor = "current_thread", start_paused = true)]
async fn t() {}
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Writing `#[tokio::test(flavor = "multi_thread", start_paused = true)]` or `#[tokio::main(flavor = "multi_thread", start_paused = true)]`.

Common situations: Wanting paused time in tests but defaulting to (or copying) a multi-thread flavor; mixing test-only options into a multi-thread entry point.

Related errors


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