{"record":{"id":"bc052181f4656109","repo":"dbt-labs/dbt-core","slug":"argument-to-has-incompatible-type-expe","errorCode":null,"errorMessage":"argument {} to {}() has incompatible type {}; expected DataType","messagePattern":"argument (.+?) to (.+?)\\(\\) has incompatible type (.+?); expected DataType","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-agate/src/data_type.rs","lineNumber":159,"sourceCode":"    fn eq(&self, other: &Self) -> bool {\n        self.0.eq_repr(&*other.0)\n    }\n}\n\nimpl Object for DataType {\n    fn call_method(\n        self: &Arc<Self>,\n        _state: &State,\n        name: &str,\n        args: &[Value],\n        _listeners: &[Rc<dyn RenderingEventListener>],\n    ) -> Result<Value, Error> {\n        let as_data_type = |x: &str, fname: &str, value: &Value| {\n            value\n                .downcast_object_ref::<&dyn DataTypeRepr>()\n                .ok_or_else(|| {\n                    let got = ArgsIter::type_name_of_value(Some(value));\n                    Error::new(\n                        ErrorKind::InvalidArgument,\n                        format!(\n                            \"argument {} to {}() has incompatible type {}; expected DataType\",\n                            x,\n                            fname,\n                            got.as_ref(),\n                        ),\n                    )\n                })\n                .copied()\n        };\n        match name {\n            // DataType methods\n            \"test\" => {\n                let args_iter = ArgsIter::new(name, &[\"d\"], args);\n                let d = args_iter.next_arg::<&Value>()?;\n                args_iter.finish()?;\n","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-agate/src/data_type.rs#L141-L177","documentation":"A DataType Jinja method (cast/test/csvify/jsonify) received a 'd' argument that is not a DataType object — downcast_object_ref failed. The helper formats the argument position, method name, and the received type name so the bad call site can be identified.","triggerScenarios":"Thrown at crates/dbt-agate/src/data_type.rs:159 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a DataType instance (e.g. from another column's type or a type-tester), not a string or number","Construct the target type via its DataType object in the template","Accept type-name strings by adding a from-string coercion if templates need it"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}