dbt-labs/dbt-core · error · syn::Error

`start_paused` set multiple times.

Error message

`start_paused` set multiple times.

What it means

The `start_paused` attribute option may appear only once per #[tokio::main]/#[tokio::test]. set_start_paused checks the stored Option and returns a syn::Error at the duplicate key's span if already set. Compile-time duplicate detection keeps the generated BuilderConfig unambiguous.

Source

Thrown at crates/dbt-runtime-macros/src/entry.rs:160

    ) -> 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 0267ce9170)

Solutions

  1. Keep only one `start_paused = <bool>` key in the attribute
  2. Use a boolean literal true/false; remove redundant repeats
  3. Use time_paused explicitly in tests via runtime Builder if you need dynamic control

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

Validate before calling

fn check_attr_keys_once(attr_src: &str, key: &str) -> Result<(), String> {
    let n = attr_src.matches(&format!("{} =", key)).count();
    if n <= 1 { Ok(()) } else { Err(format!("duplicate `{key}`")) }
}

Prevention

When it happens

Trigger: #[tokio::test(start_paused = true, start_paused = false)] — the key `start_paused` appears twice within one attribute invocation.

Common situations: Merging test attributes when refactoring; a code generator emitting the option twice; accidentally duplicating a key while toggling values.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07). Data as JSON: /api/errors/f0ce12d3c58c5ca4. Report an issue: GitHub.