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

`start_paused` set multiple times.

Error message

`start_paused` set multiple times.

What it means

`set_start_paused` (entry.rs:146) records the first `start_paused = bool` and rejects a second one. `start_paused` controls whether tokio's test clock starts paused and is only valid for the `current_thread` flavor.

Source

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

    ) -> Result<(), syn::Error> {
        if self.worker_threads.is_some() {
            return Err(syn::Error::new(
                span,
                "`worker_threads` set multiple times.",
            ));
        }

        let worker_threads = parse_int(worker_threads, span, "worker_threads")?;
        if worker_threads == 0 {
            return Err(syn::Error::new(span, "`worker_threads` may not be 0."));
        }
        self.worker_threads = Some((worker_threads, span));
        Ok(())
    }

    fn set_start_paused(&mut self, start_paused: syn::Lit, span: Span) -> Result<(), syn::Error> {
        if self.start_paused.is_some() {
            return Err(syn::Error::new(span, "`start_paused` set multiple times."));
        }

        let start_paused = parse_bool(start_paused, span, "start_paused")?;
        self.start_paused = Some((start_paused, span));
        Ok(())
    }

    fn set_crate_name(&mut self, name: syn::Lit, span: Span) -> Result<(), syn::Error> {
        if self.crate_name.is_some() {
            return Err(syn::Error::new(span, "`crate` set multiple times."));
        }
        let name_path = parse_path(name, span, "crate")?;
        self.crate_name = Some(name_path);
        Ok(())
    }

    fn set_unhandled_panic(
        &mut self,

View on GitHub (pinned to 625954f365)

Solutions

  1. Remove the duplicate `start_paused`, keeping the single intended boolean.

Example fix

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

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

Strategy: validation

Prevention

When it happens

Trigger: Writing `#[tokio::test(start_paused = true, start_paused = false)]`.

Common situations: Copy-paste; combining two test setups.

Related errors


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