{"record":{"id":"a2194fcf5d7ea05d","repo":"tokio-rs/tokio","slug":"failed-to-parse-value-of-field-as-bool","errorCode":null,"errorMessage":"Failed to parse value of `{field}` as bool.","messagePattern":"Failed to parse value of `(.+?)` as bool\\.","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"tokio-macros/src/entry.rs","lineNumber":306,"sourceCode":"                    field,\n                    s.value()\n                ),\n            );\n            s.parse::<syn::Path>().map_err(|_| err.clone())\n        }\n        _ => Err(syn::Error::new(\n            span,\n            format!(\"Failed to parse value of `{field}` as path.\"),\n        )),\n    }\n}\n\nfn parse_bool(bool: syn::Lit, span: Span, field: &str) -> Result<bool, syn::Error> {\n    match bool {\n        syn::Lit::Bool(b) => Ok(b.value),\n        _ => Err(syn::Error::new(\n            span,\n            format!(\"Failed to parse value of `{field}` as bool.\"),\n        )),\n    }\n}\n\nfn contains_impl_trait(ty: &syn::Type) -> bool {\n    match ty {\n        syn::Type::ImplTrait(_) => true,\n        syn::Type::Array(t) => contains_impl_trait(&t.elem),\n        syn::Type::Ptr(t) => contains_impl_trait(&t.elem),\n        syn::Type::Reference(t) => contains_impl_trait(&t.elem),\n        syn::Type::Slice(t) => contains_impl_trait(&t.elem),\n        syn::Type::Tuple(t) => t.elems.iter().any(contains_impl_trait),\n        syn::Type::Paren(t) => contains_impl_trait(&t.elem),\n        syn::Type::Group(t) => contains_impl_trait(&t.elem),\n        syn::Type::Path(t) => match t.path.segments.last() {\n            Some(segment) => match &segment.arguments {\n                syn::PathArguments::AngleBracketed(args) => args.args.iter().any(|arg| match arg {\n                    syn::GenericArgument::Type(t) => contains_impl_trait(t),","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/tokio-rs/tokio/blob/625954f365727668cb02d04172b34f1149637728/tokio-macros/src/entry.rs#L288-L324","documentation":"Compile-time error from `parse_bool`'s `_` arm: the value for a boolean field is not `syn::Lit::Bool`. Used only by the `start_paused` field (see `set_start_paused` calling `parse_bool(..., \"start_paused\")` in entry.rs:151).","triggerScenarios":"`#[tokio::main(start_paused = 1)]`, `start_paused = \"true\"`, or `start_paused = 'y'`. Any non-boolean literal.","commonSituations":"Using `1`/`0` or a quoted `\"true\"`/`\"false\"` (carried over from JSON/ENV config habits); `start_paused` also requires the `current_thread` flavor, so the boolean shape must be correct before the flavor check in `build()`.","solutions":["Use an unquoted boolean literal: `#[tokio::main(flavor = \"current_thread\", start_paused = true)]`.","Remember `start_paused` only works with `current_thread` flavor; set both together."],"exampleFix":"// before\n#[tokio::main(start_paused = \"true\")]\nasync fn main() {}\n\n// after\n#[tokio::main(flavor = \"current_thread\", start_paused = true)]\nasync fn main() {}","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use unquoted Rust booleans (`true`/`false`) for `start_paused` — not `1`/`0` or quoted strings.","`start_paused` requires `flavor = \"current_thread\"`; set both together."],"tags":["rust","tokio","macros","configuration","compile-time"],"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"}