{"record":{"id":"1c35bf9daa864af6","repo":"dbt-labs/dbt-core","slug":"the-worker-threads-option-requires-the-multi-th","errorCode":null,"errorMessage":"The `worker_threads` option requires the `multi_thread` runtime flavor. Use `#[{macro_name}(flavor = \"multi_thread\")]`","messagePattern":"The `worker_threads` option requires the `multi_thread` runtime flavor\\. Use `#\\[(.+?)\\(flavor = \"multi_thread\"\\)\\]`","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/dbt-runtime-macros/src/entry.rs","lineNumber":215,"sourceCode":"        if self.is_test {\n            \"dbt_runtime::test\"\n        } else {\n            \"dbt_runtime::main\"\n        }\n    }\n\n    fn build(&self) -> Result<FinalConfig, syn::Error> {\n        use RuntimeFlavor as F;\n\n        let flavor = self.flavor.unwrap_or(self.default_flavor);\n\n        let worker_threads = match (flavor, self.worker_threads) {\n            (F::CurrentThread | F::Local, Some((_, worker_threads_span))) => {\n                let msg = format!(\n                    \"The `worker_threads` option requires the `multi_thread` runtime flavor. Use `#[{}(flavor = \\\"multi_thread\\\")]`\",\n                    self.macro_name(),\n                );\n                return Err(syn::Error::new(worker_threads_span, msg));\n            }\n            (F::CurrentThread | F::Local, None) => None,\n            (F::Threaded, worker_threads) if self.rt_multi_thread_available => {\n                worker_threads.map(|(val, _span)| val)\n            }\n            (F::Threaded, _) => {\n                let msg = if self.flavor.is_none() {\n                    \"The default runtime flavor is `multi_thread`, but the `rt-multi-thread` feature is disabled.\"\n                } else {\n                    \"The runtime flavor `multi_thread` requires the `rt-multi-thread` feature.\"\n                };\n                return Err(syn::Error::new(Span::call_site(), msg));\n            }\n        };\n\n        let start_paused = match (flavor, self.start_paused) {\n            (F::Threaded, Some((_, start_paused_span))) => {\n                let msg = format!(","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-runtime-macros/src/entry.rs#L197-L233","documentation":"The `worker_threads` option only makes sense for the multi_thread flavor; current_thread (and local) runtimes are single-threaded, so the macro's build() validation rejects the combination at compile time and points the error at the worker_threads value's span. The message suggests adding flavor = \"multi_thread\".","triggerScenarios":"#[tokio::main(flavor = \"current_thread\", worker_threads = 4)] or #[tokio::test(flavor = \"current_thread\", worker_threads = 2)] — any pairing of current_thread/local flavor with a Some(worker_threads).","commonSituations":"Switching a test from multi_thread to current_thread for determinism and forgetting to delete worker_threads; cargo feature changes making rt-multi-thread unavailable; copying config across attributes.","solutions":["Remove the worker_threads option when using flavor = \"current_thread\" or \"local\"","Change the flavor to \"multi_thread\" if you actually need multiple workers","Set the rt-multi-thread feature so multi_thread flavor is available"],"exampleFix":"// before\n#[tokio::test(flavor = \"current_thread\", worker_threads = 4)]\nasync fn t() {}\n\n// after\n#[tokio::test(flavor = \"current_thread\")]\nasync fn t() {}","handlingStrategy":"validation","validationCode":"fn check_attr_compat(flavor: &str, worker_threads: Option<u64>) -> Result<(), String> {\n    if flavor != \"multi_thread\" && worker_threads.is_some() {\n        Err(format!(\"worker_threads requires flavor=\\\"multi_thread\\\" (got {flavor})\"))\n    } else { Ok(()) }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Whenever you change flavor, delete worker_threads in the same edit","Remember current_thread/local runtimes are single-threaded by design","Run cargo check immediately after changing test attributes"],"tags":["rust","proc-macro","tokio","incompatible-options"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}