{"record":{"id":"598d1ee7713f7d04","repo":"dbt-labs/dbt-core","slug":"model-columns-e","errorCode":null,"errorMessage":"model_columns: {e}","messagePattern":"model_columns: (.+?)","errorType":"exception","errorClass":"minijinja::Error::SerdeDeserializeError","httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/adapter/adapter_impl.rs","lineNumber":4669,"sourceCode":"            .map_err(|e| {\n                minijinja::Error::new(\n                    minijinja::ErrorKind::InvalidOperation,\n                    format!(\"existing_columns must be iterable: {e}\"),\n                )\n            })?\n            .map(|v| {\n                v.downcast_object_ref::<Column>().cloned().ok_or_else(|| {\n                    minijinja::Error::new(\n                        minijinja::ErrorKind::InvalidOperation,\n                        \"existing_columns must contain Column objects\",\n                    )\n                })\n            })\n            .collect::<Result<Vec<_>, _>>()?;\n\n        let model_columns_map: BTreeMap<String, DbtColumn> =\n            minijinja_value_to_typed_struct(model_columns.clone()).map_err(|e| {\n                minijinja::Error::new(\n                    minijinja::ErrorKind::SerdeDeserializeError,\n                    format!(\"model_columns: {e}\"),\n                )\n            })?;\n\n        let model_constraints_vec: Vec<ModelConstraint> =\n            minijinja_value_to_typed_struct(model_constraints.clone()).map_err(|e| {\n                minijinja::Error::new(\n                    minijinja::ErrorKind::SerdeDeserializeError,\n                    format!(\"model_constraints: {e}\"),\n                )\n            })?;\n\n        let column_refs: Vec<DbtColumnRef> = model_columns_map\n            .values()\n            .map(|c| Arc::new(c.clone()))\n            .collect();\n","sourceCodeStart":4651,"sourceCodeEnd":4687,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/adapter/adapter_impl.rs#L4651-L4687","documentation":"parse_columns_and_constraints deserializes the model_columns argument into a BTreeMap<String, DbtColumn> (and then model constraints into Vec<ModelConstraint>). Any serde failure is wrapped in a SerdeDeserializeError prefixed with 'model_columns:'. This validates that the model's column definitions match the expected struct shape before constraint parsing.","triggerScenarios":"Calling parse_columns_and_constraints with model_columns that cannot deserialize into IndexMap/BTreeMap<String, DbtColumn>: list instead of map, entries missing required DbtColumn fields, or wrong-typed fields.","commonSituations":"Passing model.config.columns in an unusual shape; custom materializations that reshape columns before this call; constraints defined with unexpected keys in model config; schema.yml columns with nonstandard metadata keys mapped into the column struct.","solutions":["Read the text after 'model_columns:' in the error — it names the failing field — and fix the config.","Pass model.columns as a name -> column map with standard dbt column fields.","Ensure model constraints follow the documented ModelConstraint structure (name/type/expr etc.).","Avoid transforming model.columns in custom macros before calling this API."],"exampleFix":"// before\nmodel_columns = [(\"id\", \"int\")]  # list of tuples\nadapter.parse_columns_and_constraints(existing, model_columns, name)\n\n// after\nmodel_columns = {\"id\": {\"name\": \"id\", \"data_type\": \"int\"}}\nadapter.parse_columns_and_constraints(existing, model_columns, name)","handlingStrategy":"validation","validationCode":"def is_model_column_map(v):\n    return isinstance(v, dict) and all(\n        isinstance(k, str) and isinstance(c, dict) and 'name' in c\n        for k, c in v.items())","typeGuard":"def as_model_columns(v):\n    return v if is_model_column_map(v) else None","tryCatchPattern":"try:\n    parsed = adapter.parse_columns_and_constraints(existing, model_columns, name)\nexcept Exception as e:\n    if str(e).startswith('model_columns:'):\n        raise ValueError(f'model.columns shape invalid: {e}') from e\n    raise","preventionTips":["Pass model.columns unmodified as a name -> column map","Use standard dbt column fields (name, data_type, description, ...) only","Validate constraint definitions against the ModelConstraint schema","Compile the model standalone to surface config-shape errors early"],"tags":["serde","deserialization","databricks","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"}