{"record":{"id":"c8c16b5f3cbd582a","repo":"dbt-labs/dbt-core","slug":"failed-to-parse-value-of-field-as-integer-e","errorCode":null,"errorMessage":"Failed to parse value of `{field}` as integer: {e}","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":270,"sourceCode":"            (_, None) => None,\n        };\n\n        Ok(FinalConfig {\n            name: self.name.clone(),\n            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.\"),","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-runtime-macros/src/entry.rs#L252-L288","documentation":"Raised by the `parse_int` helper in crates/dbt-runtime-macros/src/entry.rs (called from setters like `set_worker_threads`) when an integer-valued attribute option (e.g. `worker_threads = ...`) is a literal of type syn::Lit::Int but its digits cannot be parsed into a `usize` (e.g. overflow of usize, or an invalid base-10 integer form). The underlying parse error is included in the message.","triggerScenarios":"Passing `worker_threads = 999999999999999999999999` (exceeds usize range) or another syntactically valid integer literal whose value overflows `usize::from_str_radix`-style base-10 parsing. Called during macro attribute parsing via `set_worker_threads`.","commonSituations":"Hand-writing a huge or negative-looking worker thread count; generating attribute values programmatically (codegen) that overflow usize; copy-pasting a value with stray characters that syn accepts as an Int literal but base10_parse rejects.","solutions":["Reduce the value so it fits in a usize (e.g. a realistic thread count like `worker_threads = 8`).","Read the wrapped inner parse error in the message to see why the literal was rejected (overflow vs format) and fix accordingly.","For dynamic configuration, take worker count from an env var at runtime instead of baking an overflowing literal into the attribute."],"exampleFix":"// before\n#[dbt_runtime::main(worker_threads = 99999999999999999999999)]\nasync fn main() { /* ... */ }\n\n// after\n#[dbt_runtime::main(flavor = \"multi_thread\", worker_threads = 8)]\nasync fn main() { /* ... */ }","handlingStrategy":"validation","validationCode":"// Check the literal fits in usize before placing it in the attribute.\nconst WORKER_THREADS: u64 = 8;\nconst _: () = assert!(WORKER_THREADS <= usize::MAX as u64, \"worker_threads overflows usize\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use small, realistic thread counts in attributes; do not compute them into huge literals.","Configure worker counts via env/runtime instead of hardcoding extreme values.","Read the trailing inner-error text in the message; it names the exact parse failure (usually overflow)."],"tags":["rust","macros","compile-time","integer-parse","attribute"],"backgroundTag":"invalid-argument-value","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"}