influxdata/influxdb · error · Error
specified column (id: ) does not exist in the table…
Error message
specified column (id: {column_id}) does not exist in the table definition What it means
This is the `ColumnDoesNotExistById` variant of the last-cache `Error` enum in influxdb3_cache. It is raised when a last-of-value cache is being created or configured with a column referenced by its numeric ColumnId that is not present in the table's schema definition. The cache layer validates every referenced column against the current table definition before building the cache, and fails fast when the id resolves to no column.
Solutions
- Print the table schema (e.g. via `information_schema` or the table's `Schema`) and use column NAMES instead of ids when configuring the last cache
- Refresh the ColumnId from the current schema — get it by name via the table definition before building the cache
- Re-run schema discovery after any ALTER TABLE so captured ids are not stale
Example fix
// before
let col_id: ColumnId = 7; // stale id from old schema
let cfg = LastCacheConfig::new(name, count, ttl, key_cols, vec![col_id]);
// after
let col_id = table_def.schema().column_id_by_name("temperature")
.expect("column 'temperature' exists in table definition");
let cfg = LastCacheConfig::new(name, count, ttl, key_cols, vec![col_id]); Defensive patterns
Strategy: validation
Validate before calling
fn validate_value_column(schema: &Schema, col_id: ColumnId) -> Result<(), String> {
schema.field_id(col_id)
.map(|_| ())
.ok_or_else(|| format!("column id {col_id} not found in table schema"))
} Type guard
fn column_exists(schema: &Schema, col_id: ColumnId) -> bool {
schema.field_id(col_id).is_some()
} Try / catch
match provider.create_last_cache(&db_name, &tbl_name, cfg) {
Err(LastCacheError::ColumnDoesNotExistById { column_id }) => {
eprintln!("cache references unknown column id {column_id}; refresh schema and retry");
}
Err(e) => return Err(e.into()),
Ok(_) => {}
} Prevention
- Always resolve column ids from the live schema immediately before cache creation
- Use column names in configuration and convert to ids at the last moment
- Re-generate cache configs after any ALTER TABLE or table recreation
When it happens
Trigger: Calling `LastCacheProvider::create_last_cache` (or create_from_table) with a `value_columns` list or column configuration containing a ColumnId that is not in the table schema; passing a stale ColumnId captured from an older schema version after the table's columns were re-created with new ids.
Common situations: Referencing column ids from cached/outdated schema metadata after a `CREATE TABLE` or `ALTER TABLE` re-created the table; copying hard-coded column ids between environments whose schemas differ; mixing up ColumnId with column name in cache configuration code.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- column id in series key should be valid
- only uint64, int64, bool, tag, and string columns are…
- specified key column
- specified key column
- specified value column
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/b9fb2dd9421cc2f9.
Report an issue: GitHub.
Appendix: source
Thrown at influxdb3_cache/src/last_cache/mod.rs:24
pub use cache::CreateLastCacheArgs;
mod metrics;
mod provider;
pub use provider::{LastCacheProvider, background_catalog_update};
mod table_function;
use schema::InfluxColumnType;
pub use table_function::{LAST_CACHE_UDTF_NAME, LastCacheFunction};
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("invalid cache size")]
InvalidCacheSize,
#[error(
"last cache already exists for database and table, but it was configured differently: {reason}"
)]
CacheAlreadyExists { reason: String },
#[error("specified column (name: {column_name}) does not exist in the table definition")]
ColumnDoesNotExistByName { column_name: String },
#[error("specified column (id: {column_id}) does not exist in the table definition")]
ColumnDoesNotExistById { column_id: ColumnId },
#[error("specified key column (id: {column_id}) does not exist in the table schema")]
KeyColumnDoesNotExist { column_id: ColumnId },
#[error("specified key column (name: {column_name}) does not exist in the table schema")]
KeyColumnDoesNotExistByName { column_name: String },
#[error("key column must be string, int, uint, or bool types, got: {column_type}")]
InvalidKeyColumn { column_type: InfluxColumnType },
#[error("specified value column ({column_id}) does not exist in the table schema")]
ValueColumnDoesNotExist { column_id: ColumnId },
#[error("requested last cache does not exist")]
CacheDoesNotExist,
}
impl Error {
fn cache_already_exists(reason: impl Into<String>) -> Self {
Self::CacheAlreadyExists {
reason: reason.into(),
}View on GitHub (pinned to 06200ef96b)