{"record":{"id":"68ddeac24a4c0198","repo":"tokio-rs/tokio","slug":"the-default-runtime-flavor-is-multi-thread-but","errorCode":null,"errorMessage":"The default runtime flavor is `multi_thread`, but the `rt-multi-thread` feature is disabled.","messagePattern":"The default runtime flavor is `multi_thread`, but the `rt-multi-thread` feature is disabled\\.","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"tokio-macros/src/entry.rs","lineNumber":211,"sourceCode":"        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!(\n                    \"The `start_paused` option requires the `current_thread` runtime flavor. Use `#[{}(flavor = \\\"current_thread\\\")]`\",\n                    self.macro_name(),\n                );\n                return Err(syn::Error::new(start_paused_span, msg));\n            }\n            (F::CurrentThread | F::Local, Some((start_paused, _))) => Some(start_paused),\n            (_, None) => None,\n        };","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/tokio-rs/tokio/blob/625954f365727668cb02d04172b34f1149637728/tokio-macros/src/entry.rs#L193-L229","documentation":"In `build` (entry.rs:210), when the flavor resolves to `Threaded` but the `rt-multi-thread` Cargo feature is *not* enabled, the macro errors. This specific message fires when the user did *not* set `flavor` explicitly, so the default (`multi_thread`) was chosen — but the feature backing it is off.","triggerScenarios":"Depending on tokio without the `rt-multi-thread` feature (e.g. only `features = [\"rt\", \"macros\"]`) while relying on the default `#[tokio::main]` flavor.","commonSituations":"Trimming tokio features for binary size; copy-pasting a dependency line that omits `rt-multi-thread`; new projects using the macro without enabling the full runtime.","solutions":["Enable the feature: `tokio = { version = \"1\", features = [\"rt-multi-thread\", \"macros\"] }`.","Or opt into the single-threaded default explicitly: `#[tokio::main(flavor = \"current_thread\")]` (requires the `rt` feature)."],"exampleFix":"# before — Cargo.toml\ntokio = { version = \"1\", features = [\"macros\"] }\n\n# after — Cargo.toml\ntokio = { version = \"1\", features = [\"rt-multi-thread\", \"macros\"] }","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enable `rt-multi-thread` when using the default `#[tokio::main]` flavor.","Or set `flavor = \"current_thread\"` to opt out of multi-threading.","Review tokio features in `Cargo.toml` whenever you change runtime flavor."],"tags":["tokio","macros","compile-error","cargo-features","config"],"backgroundTag":null,"analyzedSha":"625954f365727668cb02d04172b34f1149637728","analyzedAt":"2026-08-11T17:46:45.378Z","contentChangedAt":"2026-08-11T17:46:45.378Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}