{"record":{"id":"81032eee1b710445","repo":"dbt-labs/dbt-core","slug":"enrich-constraints-must-contain-typedconstraint-ob","errorCode":null,"errorMessage":"enrich constraints must contain TypedConstraint objects","messagePattern":"enrich constraints must contain TypedConstraint objects","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/relation/relation_object.rs","lineNumber":118,"sourceCode":"                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    }\n\n    /// Databricks: render constraints DDL for CREATE TABLE\n    fn relation_render_constraints_for_create(self: &Arc<Self>) -> 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(","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/relation/relation_object.rs#L100-L136","documentation":"The constraints sequence passed to relation_enrich iterated fine, but its items do not downcast to TypedConstraint objects — the list holds plain dicts/values instead of constraint wrappers, so per-item downcasting fails.","triggerScenarios":"Thrown at crates/dbt-adapter/src/relation/relation_object.rs:118 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Build constraints through the typed API rather than raw dicts","Convert dict-shaped constraints into TypedConstraint before calling enrich","Validate/filter items before attempting the downcast"],"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"}