dbt-labs/dbt-core · error

column identifiers must be a column name, a column index…

Error message

column identifiers must be a column name, a column index, or a sequence of either: {e}

What it means

Validation in Table::column_indices_of: after handling the single name/index cases, the `keys` value could not be iterated as a sequence of column identifiers, so try_iter failed. Interpolates the underlying type error as {e}; the at-fault input is the sequence passed as column selectors.

Solutions

  1. Pass a single column name/index or a list of names/indices
  2. Avoid passing a single string when multiple columns are intended — strings iterate by character
  3. Ensure the value is a Jinja-iterable (list/tuple), not a mapping or scalar object
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/dbt-agate/src/table.rs:189 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of dbt-labs/dbt-core@0267ce9170 (2026-09-07). Data as JSON: /api/errors/95ecb6e9c544c4ba. Report an issue: GitHub.

Appendix: source

Thrown at crates/dbt-agate/src/table.rs:189

                ),
            ))
        }
    }

    /// Indices of the columns identified by a Jinja value.
    ///
    /// `keys` may be a single column name, a single column index, or a sequence of
    /// either (the two can be mixed).
    ///
    /// If a key is not found, it is simply skipped,
    pub fn column_indices_of(&self, keys: &Value) -> Result<Vec<usize>, Error> {
        // Strings are iterable in Jinja (by character), so single identifiers have to
        // be handled before falling back to the sequence case below.
        if keys.as_str().is_some() || keys.as_i64().is_some() {
            return Ok(self.column_index_of(keys)?.into_iter().collect());
        }
        let iter = keys.try_iter().map_err(|e| {
            Error::new(
                ErrorKind::InvalidArgument,
                format!(
                    "column identifiers must be a column name, a column index, or a sequence of either: {e}"
                ),
            )
        })?;
        let mut indices = Vec::new();
        for key in iter {
            if let Some(idx) = self.column_index_of(&key)? {
                indices.push(idx);
            }
        }
        Ok(indices)
    }

    pub fn select<'a>(&'a self, indices: impl Iterator<Item = usize> + 'a) -> Arc<Self> {
        // get a new FlatRecordBatch with only the selected columns
        let flat = self.flat.select(indices);

View on GitHub (pinned to 0267ce9170)