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

`flavor` set multiple times.

Error message

`flavor` set multiple times.

What it means

The same proc-macro also accepts a `flavor = "..."` option at most once. `set_flavor` errors when `flavor` appears twice in the attribute configuration, again as a compile-time syn::Error at the duplicate span. After the uniqueness check, the literal is also validated as a valid RuntimeFlavor.

Source

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

            is_test,
            crate_name: None,
            unhandled_panic: None,
        }
    }

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

        let runtime_name = parse_string(name, span, "name")?;
        self.name = Some(runtime_name);
        Ok(())
    }

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

        let runtime_str = parse_string(runtime, span, "flavor")?;
        let runtime =
            RuntimeFlavor::from_str(&runtime_str).map_err(|err| syn::Error::new(span, err))?;
        self.flavor = Some(runtime);
        Ok(())
    }

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

View on GitHub (pinned to 0267ce9170)

Solutions

  1. Keep exactly one `flavor = "..."` option and delete the duplicate.
  2. If multiple flavors are intended, they belong in separate annotated items, not in one attribute.
  3. Check codegen/templates that emit the attribute for duplicated option emission.

Example fix

// before
#[entry(flavor = "core", flavor = "fusion")]
// after
#[entry(flavor = "fusion")]
Defensive patterns

Strategy: validation

Validate before calling

// grep CI check: no duplicated flavor option
// rg -n 'flavor\s*=.*flavor\s*=' --glob '*.rs' crates/

Prevention

When it happens

Trigger: `#[entry(flavor = "x", flavor = "y")]` or `flavor` repeated across merged attribute arguments — `build_config` calls `set_flavor` for each and the second call finds `self.flavor.is_some()`.

Common situations: Copy-pasted or template-generated attribute blocks; combining two attribute lines that each specify `flavor`; merge conflicts that duplicated the option.

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/40793be7bcae7642. Report an issue: GitHub.