{"record":{"id":"5eb200de83fad518","repo":"tokio-rs/tokio","slug":"failed-to-parse-value-of-field-as-path","errorCode":null,"errorMessage":"Failed to parse value of `{field}` as path.","messagePattern":"Failed to parse value of `(.+?)` as path\\.","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"tokio-macros/src/entry.rs","lineNumber":296,"sourceCode":"    }\n}\n\nfn parse_path(lit: syn::Lit, span: Span, field: &str) -> Result<Path, syn::Error> {\n    match lit {\n        syn::Lit::Str(s) => {\n            let err = syn::Error::new(\n                span,\n                format!(\n                    \"Failed to parse value of `{}` as path: \\\"{}\\\"\",\n                    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),","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/tokio-rs/tokio/blob/625954f365727668cb02d04172b34f1149637728/tokio-macros/src/entry.rs#L278-L314","documentation":"Compile-time error from `parse_path`'s `_` arm: the value for the `crate` field is not a string literal at all. Distinct from error 22 (which fires when the string is present but unparseable).","triggerScenarios":"`#[tokio::main(crate = 5)]`, `crate = true`, or `crate = 'a'`. Any non-string token for the `crate` field.","commonSituations":"Passing the crate as an identifier/path (`crate = my_tokio`) instead of a quoted string; passing a number/bool by mistake.","solutions":["Quote the path: `#[tokio::main(crate = \"my_tokio\")]`.","Drop the `crate` option if you are not repointing the macro to a renamed crate."],"exampleFix":"// before\n#[tokio::main(crate = my_tokio)]\nasync fn main() {}\n\n// after\n#[tokio::main(crate = \"my_tokio\")]\nasync fn main() {}","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["The `crate` field expects a quoted string literal, not an identifier or number.","Prefer omitting `crate` unless you are vendoring/renaming tokio.","Keep a single canonical macro snippet in docs."],"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"}