{"record":{"id":"bb9b5e9e4ad7e879","repo":"dbt-labs/dbt-core","slug":"column-identifier-must-be-a-column-name-or-a-colum","errorCode":null,"errorMessage":"column identifier must be a column name or a column index: {key} found instead","messagePattern":"column identifier must be a column name or a column index: (.+?) found instead","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-agate/src/table.rs","lineNumber":167,"sourceCode":"    pub fn column_indices<'a>(&'a self, keys: &'a [String]) -> impl Iterator<Item = usize> + 'a {\n        let fields = self.flat.schema_ref().as_ref().fields();\n        let iter = keys\n            .iter()\n            .filter_map(|k| fields.iter().position(|f| f.name() == k));\n        iter\n    }\n\n    /// Index of the column with the given name or at the given index.\n    ///\n    /// `None` if the name is not found or the index is out of range.\n    fn column_index_of(&self, key: &Value) -> Result<Option<usize>, Error> {\n        if let Some(name) = key.as_str() {\n            let fields = self.flat.schema_ref().as_ref().fields();\n            Ok(fields.iter().position(|f| f.name() == name))\n        } else if let Some(idx) = key.as_i64() {\n            Ok(adjusted_index(idx as isize, self.num_columns()))\n        } else {\n            Err(Error::new(\n                ErrorKind::InvalidArgument,\n                format!(\n                    \"column identifier must be a column name or a column index: {key} found instead\"\n                ),\n            ))\n        }\n    }\n\n    /// Indices of the columns identified by a Jinja value.\n    ///\n    /// `keys` may be a single column name, a single column index, or a sequence of\n    /// either (the two can be mixed).\n    ///\n    /// If a key is not found, it is simply skipped,\n    pub fn column_indices_of(&self, keys: &Value) -> Result<Vec<usize>, Error> {\n        // Strings are iterable in Jinja (by character), so single identifiers have to\n        // be handled before falling back to the sequence case below.\n        if keys.as_str().is_some() || keys.as_i64().is_some() {","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-agate/src/table.rs#L149-L185","documentation":"Validation in Table::column_index_of: the Jinja value used as a column identifier is neither a string (column name) nor an integer (column index). The offending value is interpolated as {key}; the caller passed an unusable type where a name or index was expected.","triggerScenarios":"Thrown at crates/dbt-agate/src/table.rs:167 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a column name string or a zero-based column index integer","Wrap multiple identifiers in a list instead of passing a dict or other object","Check that the identifier value is not None/undefined in the template"],"exampleFix":null,"handlingStrategy":"validation","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"}