{"record":{"id":"e7ad0a9c84cb6a1b","repo":"dbt-labs/dbt-core","slug":"failed-to-parse-value-of-field-as-integer","errorCode":null,"errorMessage":"Failed to parse value of `{field}` as integer.","messagePattern":"Failed to parse value of `(.+?)` as integer\\.","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/dbt-runtime-macros/src/entry.rs","lineNumber":275,"sourceCode":"            crate_name: self.crate_name.clone(),\n            flavor,\n            worker_threads,\n            start_paused,\n            unhandled_panic,\n        })\n    }\n}\n\nfn parse_int(int: syn::Lit, span: Span, field: &str) -> Result<usize, syn::Error> {\n    match int {\n        syn::Lit::Int(lit) => match lit.base10_parse::<usize>() {\n            Ok(value) => Ok(value),\n            Err(e) => Err(syn::Error::new(\n                span,\n                format!(\"Failed to parse value of `{field}` as integer: {e}\"),\n            )),\n        },\n        _ => Err(syn::Error::new(\n            span,\n            format!(\"Failed to parse value of `{field}` as integer.\"),\n        )),\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> {","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-runtime-macros/src/entry.rs#L257-L293","documentation":"Raised by the `parse_int` helper in crates/dbt-runtime-macros/src/entry.rs when an integer-valued attribute option (e.g. `worker_threads`) is given a literal that is not an integer at all — anything other than syn::Lit::Int, such as a string or bool literal. The macro rejects it at expansion time with a plain message naming the field.","triggerScenarios":"Writing `worker_threads = \"8\"` (string instead of integer literal) or `worker_threads = true` in the attribute; passing any non-Int literal to a field parsed by `parse_int` via `set_worker_threads`.","commonSituations":"Quoting numeric attribute values out of habit; generating attributes from config where the value was serialized as a string; editing an attribute and accidentally adding quotes.","solutions":["Remove the quotes: use an unquoted integer literal, e.g. `worker_threads = 4`.","Ensure the field you set is one that expects an integer; string-valued options (name, flavor, unhandled_panic) should not use parse_int fields.","Check codegen/config templating so numeric values are emitted unquoted."],"exampleFix":"// before\n#[dbt_runtime::main(worker_threads = \"4\")]\nasync fn main() { /* ... */ }\n\n// after\n#[dbt_runtime::main(flavor = \"multi_thread\", worker_threads = 4)]\nasync fn main() { /* ... */ }","handlingStrategy":"validation","validationCode":"// Integer options must be unquoted integer literals in the attribute.\n// WRONG: #[dbt_runtime::main(worker_threads = \"4\")]\n// RIGHT:\n#[dbt_runtime::main(flavor = \"multi_thread\", worker_threads = 4)]\nasync fn main() {}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never quote numeric attribute values.","Check templating/codegen output so numeric fields are emitted as bare literals.","Only use integer literals on integer options (worker_threads); strings go to name/flavor/unhandled_panic."],"tags":["rust","macros","compile-time","type-mismatch","attribute"],"backgroundTag":"type-mismatch","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"}