{"record":{"id":"f09c204647567778","repo":"dbt-labs/dbt-core","slug":"column-must-have-a-name-attribute","errorCode":null,"errorMessage":"column must have a name attribute","messagePattern":"column must have a name attribute","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-schemas/src/schemas/manifest/bigquery_partition.rs","lineNumber":186,"sourceCode":"            \"timestamp\"\n        };\n        Ok(MinijinjaValue::from(data_type))\n    }\n\n    pub fn reject_partition_field_column(\n        &self,\n        args: &[MinijinjaValue],\n    ) -> Result<MinijinjaValue, MinijinjaError> {\n        let mut parser = ArgParser::new(args, None);\n        parser.check_num_args(current_function_name!(), 0, 1)?;\n\n        let columns = parser.get::<MinijinjaValue>(\"columns\")?;\n        if let Ok(iter) = columns.try_iter() {\n            let columns = iter\n                .filter(|c| {\n                    let name = c\n                        .get_attr(\"name\")\n                        .expect(\"column must have a name attribute\");\n                    !name\n                        .as_str()\n                        .expect(\"name attribute must be a string\")\n                        .eq_ignore_ascii_case(self.field.as_str())\n                })\n                .collect::<Vec<_>>();\n            Ok(MinijinjaValue::from(columns))\n        } else {\n            Err(MinijinjaError::new(\n                MinijinjaErrorKind::InvalidArgument,\n                \"columns must be a list of Column\",\n            ))\n        }\n    }\n\n    /// Return true if the data type should be truncated instead of cast to the data type\n    pub fn data_type_should_be_truncated(&self) -> bool {\n        !(self.data_type == \"int64\"","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-schemas/src/schemas/manifest/bigquery_partition.rs#L168-L204","documentation":"In the BigQuery partition filter (`reject_partition_field_column`) exposed to Jinja, each model `columns` entry is expected to expose a `name` attribute. `c.get_attr(\"name\").expect(...)` panics when a column value lacks that attribute. The filter is used to exclude the partition field from column lists in rendered SQL, so any column-shaped value without `name` breaks the render with a Rust panic surfaced through the template engine.","triggerScenarios":"Rendering a BigQuery partition-related template (e.g. `partition_by` expressions) where the `columns` iterable contains values without a `name` attribute — e.g. columns defined as plain strings, dicts using a different key, or None entries in the model's `columns` config.","commonSituations":"A model config defines `columns` with non-standard shapes (lists of strings instead of `{name: ..., ...}` dicts); a custom/older adapter materialization passes malformed column values into the partition filter; hand-written YAML where column entries omit the `name` key.","solutions":["Ensure every entry in the model's `columns` config is a mapping with a `name` key in schema/YAML","Check that the caller feeding `columns` into this filter passes parsed column structs (which always have `name`), not raw template values","If you control the template, pre-filter columns for `name` presence before invoking the partition filter"],"exampleFix":"// before\nlet name = c.get_attr(\"name\").expect(\"column must have a name attribute\");\n// after\nlet name = match c.get_attr(\"name\") {\n    Ok(n) => n,\n    Err(_) => return true, // keep columns without a name\n};","handlingStrategy":"validation","validationCode":"// validate columns in the model config before rendering partition SQL\nfor col in &model.columns {\n    if col.get(\"name\").map_or(true, |v| !v.is_string()) {\n        return Err(\"every column must have a string 'name' attribute\".into());\n    }\n}","typeGuard":"fn has_string_name(col: &MinijinjaValue) -> bool {\n    col.get_attr(\"name\").map(|n| n.as_str().is_some()).unwrap_or(false)\n}","tryCatchPattern":"let filtered = std::panic::catch_unwind(|| partition_cfg.reject_partition_field_column(columns));","preventionTips":["Define schema column entries as mappings with a quoted string `name` key","Quote numeric-looking column names in YAML (name: \"2024\")","Lint model YAML so columns without `name` are rejected before execution"],"tags":["bigquery","partitioning","jinja","panic"],"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-14T11:17:12.474Z"}