{"record":{"id":"d8c0ce06af84cd27","repo":"dbt-labs/dbt-core","slug":"e-d8c0ce","errorCode":null,"errorMessage":"{e}","messagePattern":"\\{e\\}","errorType":"exception","errorClass":"minijinja::Error::SerdeDeserializeError","httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/adapter/mod.rs","lineNumber":782,"sourceCode":"    /// ) -> List[str]\n    ///\n    /// ```\n    #[tracing::instrument(skip_all, level = \"trace\")]\n    pub fn render_raw_model_constraints(\n        &self,\n        state: &State,\n        args: &[Value],\n    ) -> Result<Value, minijinja::Error> {\n        match &self.inner {\n            Typed { adapter, .. } => {\n                let iter =\n                    ArgsIter::new(\"render_raw_model_constraints\", &[\"raw_constraints\"], args);\n                let raw_constraints_val = iter.next_arg::<&Value>()?;\n                let raw_constraints = minijinja_value_to_typed_struct::<Vec<ModelConstraint>>(\n                    raw_constraints_val.clone(),\n                )\n                .map_err(|e| {\n                    minijinja::Error::new(\n                        minijinja::ErrorKind::SerdeDeserializeError,\n                        e.to_string(),\n                    )\n                })?;\n                iter.finish()?;\n\n                if let Some(replay_adapter) = adapter.as_replay() {\n                    return replay_adapter\n                        .replay_render_raw_model_constraints(state, &raw_constraints);\n                }\n                let mut result = vec![];\n                for constraint in &raw_constraints {\n                    warn_constraint_support(\n                        adapter.adapter_type(),\n                        constraint.type_,\n                        adapter.get_constraint_support(constraint.type_),\n                        constraint.warn_unsupported,\n                        constraint.warn_unenforced,","sourceCodeStart":764,"sourceCodeEnd":800,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/adapter/mod.rs#L764-L800","documentation":"`render_raw_model_constraints` deserializes its `raw_constraints` argument into `Vec<ModelConstraint>` using `minijinja_value_to_typed_struct`; any serde failure is re-raised as a SerdeDeserializeError whose message is the serde error text. The library throws it because rendered constraint SQL requires well-typed ModelConstraint inputs.","triggerScenarios":"Calling render_raw_model_constraints with raw_constraints that do not deserialize as a list of ModelConstraint — e.g. raw constraint dicts from the manifest lacking required fields, or constraints passed as plain strings.","commonSituations":"Models whose YAML constraints use an unexpected structure, custom materializations forwarding manifest values verbatim, or schema drift between dbt-core constraint serialization and the adapter's ModelConstraint struct.","solutions":["Read the appended serde message to identify which constraint field failed (e.g. missing 'type', invalid enum variant)","Normalize each constraint to a mapping with a valid `type` and optional `name`, `expression`, `columns` fields before calling","Check for version skew between dbt-core (which serializes constraints) and this adapter crate","Guard the call site with a check that raw_constraints is a list before invoking"],"exampleFix":"// before\nrender_raw_model_constraints(constraints)  # constraints = [\"not_null\"]\n// after\nrender_raw_model_constraints([{'type': 'not_null'}])","handlingStrategy":"validation","validationCode":"// guard before calling\nif !raw_constraints.is_array() || raw_constraints.iter().any(|c| !c.is_object() || c.get(\"type\").is_none()) {\n    return Err(\"raw_constraints must be a list of objects each with a 'type' field\".into());\n}","typeGuard":"fn is_constraint_list(v: &Value) -> bool {\n    v.try_iter().map(|it| it.all(|c| c.get_attr(\"type\").is_ok())).unwrap_or(false)\n}","tryCatchPattern":"let raw_constraints = minijinja_value_to_typed_struct::<Vec<ModelConstraint>>(raw_constraints_val.clone())\n    .map_err(|e| minijinja::Error::new(minijinja::ErrorKind::SerdeDeserializeError,\n        format!(\"raw_constraints: {e}; each constraint needs a valid 'type'\")))?;","preventionTips":["Validate constraint YAML shape (mapping with `type`) in CI via dbt schema checks","Keep ModelConstraint struct and dbt-core serialization in sync across upgrades","Log the offending raw_constraints value when deserialization fails"],"tags":["constraints","serde","deserialization","minijinja"],"backgroundTag":"schema-validation-failed","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"}