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

No such runtime flavor `{s}`. The runtime flavors are `curre

Error message

No such runtime flavor `{s}`. The runtime flavors are `current_thread`, `local`, and `multi_thread`.

What it means

This is a compile-time error from the proc-macro behind #[tokio::main]/#[tokio::test]. The `flavor` attribute value you passed is parsed into a RuntimeFlavor enum via from_str; any string other than `current_thread`, `local`, or `multi_thread` fails and the parse error message is surfaced as a syn::Error at that attribute position. The macro refuses to generate code for an unknown runtime flavor rather than guessing.

Source

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

    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.",
            ));
        }

        let worker_threads = parse_int(worker_threads, span, "worker_threads")?;
        if worker_threads == 0 {

View on GitHub (pinned to 0267ce9170)

Solutions

  1. Use exactly one of `current_thread`, `local`, or `multi_thread` as the flavor value
  2. Fix hyphen vs underscore: it is `multi_thread`, not `multi-thread`
  3. Remove the flavor attribute entirely to use the default (multi_thread when the rt-multi-thread feature is enabled)

Example fix

// before
#[tokio::main(flavor = "multi-thread")]
async fn main() {}

// after
#[tokio::main(flavor = "multi_thread")]
async fn main() {}
Defensive patterns

Strategy: validation

Validate before calling

const RUNTIME_FLAVORS: [&str; 3] = ["current_thread", "local", "multi_thread"];
fn check_flavor(attr_flavor: &str) -> Result<(), String> {
    if RUNTIME_FLAVORS.contains(&attr_flavor) {
        Ok(())
    } else {
        Err(format!("invalid flavor `{attr_flavor}`; use one of {RUNTIME_FLAVORS:?}"))
    }
}

Prevention

When it happens

Trigger: Calling #[tokio::main(flavor = "...")] (or #[tokio::test(flavor = "...")]) with a literal string that RuntimeFlavor::from_str does not recognize — e.g. a typo like `multi-thread`, `single_thread`, `threaded`, or a quoted-but-misspelled name. Raised in set_flavor during build_config of the attribute.

Common situations: Typo in flavor name when switching runtime flavors; copying examples from old blog posts using `single_thread`; confusing hyphen/underscore spelling; IDE autocomplete inserting the wrong identifier.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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