{"record":{"id":"66312a0621d2a9e0","repo":"dbt-labs/dbt-core","slug":"enrich-constraints-must-be-iterable-e","errorCode":null,"errorMessage":"enrich constraints must be iterable: {e}","messagePattern":"enrich constraints must be iterable: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/relation/relation_object.rs","lineNumber":109,"sourceCode":"    }\n\n    /// Databricks: enrich relation with constraints (for get_column_and_constraints_sql)\n    fn relation_enrich(self: &Arc<Self>, args: &[Value]) -> Result<Value, minijinja::Error> {\n        let dbx = self\n            .relation\n            .as_any()\n            .downcast_ref::<Relation>()\n            .ok_or_else(|| {\n                minijinja::Error::new(\n                    minijinja::ErrorKind::InvalidOperation,\n                    \"enrich is only available for Databricks relations\",\n                )\n            })?;\n        let constraints_val = args.first().cloned().unwrap_or_default();\n        let constraints: Vec<TypedConstraint> = constraints_val\n            .try_iter()\n            .map_err(|e| {\n                minijinja::Error::new(\n                    minijinja::ErrorKind::InvalidOperation,\n                    format!(\"enrich constraints must be iterable: {e}\"),\n                )\n            })?\n            .map(|v| {\n                v.downcast_object_ref::<TypedConstraint>()\n                    .cloned()\n                    .ok_or_else(|| {\n                        minijinja::Error::new(\n                            minijinja::ErrorKind::InvalidOperation,\n                            \"enrich constraints must contain TypedConstraint objects\",\n                        )\n                    })\n            })\n            .collect::<Result<Vec<_>, _>>()?;\n        let enriched = dbx.enrich(&constraints);\n        Ok(RelationObject::new(Arc::new(enriched)).into_value())\n    }","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/relation/relation_object.rs#L91-L127","documentation":"The constraints argument passed to relation_enrich cannot be iterated — try_iter failed, meaning the value is not a Jinja sequence/list (e.g. a single object or undefined), so it cannot be converted into Vec<TypedConstraint>.","triggerScenarios":"Thrown at crates/dbt-adapter/src/relation/relation_object.rs:109 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass constraints as a list of constraint objects from the model contract","Guard with an is-iterable check in the macro before calling enrich","Coerce single values into a one-element list"],"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"}