{"record":{"id":"de59973c8efefc2b","repo":"dbt-labs/dbt-core","slug":"failed-to-parse-value-of-field-as-path-path","errorCode":null,"errorMessage":"Failed to parse value of `{field}` as path: \"{path}\"","messagePattern":"Failed to parse value of `(.+?)` as path: \"(.+?)\"","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/dbt-runtime-macros/src/entry.rs","lineNumber":296,"sourceCode":"        )),\n    }\n}\n\nfn parse_string(int: syn::Lit, span: Span, field: &str) -> Result<String, syn::Error> {\n    match int {\n        syn::Lit::Str(s) => Ok(s.value()),\n        syn::Lit::Verbatim(s) => Ok(s.to_string()),\n        _ => Err(syn::Error::new(\n            span,\n            format!(\"Failed to parse value of `{field}` as string.\"),\n        )),\n    }\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 {","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-runtime-macros/src/entry.rs#L278-L314","documentation":"This compile-time error comes from a proc-macro attribute parser (tokio-style entry macro) in crates/dbt-runtime-macros/src/entry.rs. When an attribute option's value (e.g. `crate = \"...\"`) is a string literal, it is parsed as a Rust path (`syn::Path`); if the string is not syntactically a valid Rust path, the macro throws this error and compilation fails before any code runs.","triggerScenarios":"Writing a macro attribute with a `crate = \"...\"` (or similar path-valued) option whose string cannot be parsed by `syn` as a `syn::Path`, e.g. containing invalid identifiers, leading/trailing punctuation, or spaces like `crate = \"my crate\"`.","commonSituations":"Typo or non-identifier characters in the `crate` option of `#[tokio::main]`-style or dbt entry attributes; renaming a crate and leaving stale/invalid path syntax; copy-pasting a path with quotes inside quotes or whitespace.","solutions":["Make the string a valid Rust path: plain identifier or `::`-separated segments, e.g. `crate = \"my_crate\"`","Check for typos, spaces, or special characters in the attribute value","Use the raw identifier form if the crate name has unusual characters (e.g. `r#type`)","If you did not intend to override the crate, remove the attribute option entirely"],"exampleFix":"// before\n#[dbt::main(crate = \"my crate\")]\n// after\n#[dbt::main(crate = \"my_crate\")]","handlingStrategy":"validation","validationCode":"// validate at authoring time: the attribute value must be a valid Rust path\nfn is_valid_rust_path(s: &str) -> bool {\n    !s.is_empty()\n        && s.split(\"::\").all(|seg| {\n            let seg = seg.trim_start_matches(\"r#\");\n            !seg.is_empty()\n                && seg.chars().next().map_or(false, |c| c.is_alphabetic() || c == '_')\n                && seg.chars().all(|c| c.is_alphanumeric() || c == '_')\n        })\n}\n// assert!(is_valid_rust_path(\"my_crate\"));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always quote path-valued attribute options and use valid Rust identifiers","Avoid spaces, hyphens, and punctuation inside the crate/path string","Copy paths directly from Cargo.toml package names (convert hyphens to underscores)"],"tags":["proc-macro","rust","attribute","parse-error"],"backgroundTag":"invalid-argument-format","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}