influxdata/influxdb · error

field does not exist

Error message

field does not exist

What it means

Panic from `.expect("field does not exist")` after inserting a new FieldColumn into `ffd.fields` (the field family's fields map) in the v2 catalog update path. The map insert can only fail on a duplicate key — the field identifier (family id + next field number) already exists — so the expect encodes the assumption that freshly allocated field ids never collide.

Solutions

  1. Check that field-add operations are applied exactly once per catalog sequence number.
  2. Verify the family's persisted next-field-id counter is greater than all existing field ids in the snapshot/log.
  3. Restore the catalog from a backup predating the corruption.
  4. Report upstream with the failing batch if hit via supported influxdb3 APIs.

Example fix

// before
ffd.fields.insert(id.1, Arc::clone(&field_col)).expect("field does not exist");
// after
if ffd.fields.contains_key(&id.1) {
    return Err(Error::DuplicateField { family: ffd.id, field_id: id.1 });
}
ffd.fields.insert(id.1, Arc::clone(&field_col)).expect("field does not exist");
Defensive patterns

Strategy: validation

Validate before calling

// Ensure the family's next-field-id counter is past all existing fields
let next = ffd.fields.get_and_increment_next_id();
if ffd.fields.contains_key(&next) {
    return Err("corrupt next-field-id counter; rebuild family from log");
}

Type guard

fn counter_is_sane(ffd: &FieldFamilyDefinition) -> bool {
    ffd.fields.keys().all(|k| *k < ffd.next_field_id())
}

Prevention

When it happens

Trigger: Adding a field when `ffd.fields.get_and_increment_next_id()` returns an id already present in the family's fields map — e.g. replayed field-add ops, a corrupted next-field-id counter in the persisted family, or the same batch applied twice.

Common situations: Catalog WAL replayed after a crash; snapshots restored with an out-of-date next_id counter; hand-merged catalog logs; bugs in get_and_increment_next_id persistence.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/570e89fa714bd996. Report an issue: GitHub.

Appendix: source

Thrown at influxdb3_catalog/src/catalog/versions/v2/update.rs:1744

            }
        };

        let col_id = self.next_legacy_column_id()?;
        let field_col = {
            let ffd_arc = self
                .table
                .field_families
                .get_mut_by_id(&ff_id)
                .expect("field family name exists");

            // Use `Arc::make_mut` because `TableTransaction`s are created via cloning
            // `TableDefinition`s.
            let ffd = Arc::make_mut(ffd_arc);
            let id = FieldIdentifier::new(ffd.id, ffd.fields.get_and_increment_next_id());
            let field_col = Arc::new(FieldColumn::new(id, col_id, name.as_ref(), data_type));
            ffd.fields
                .insert(id.1, Arc::clone(&field_col))
                .expect("field does not exist");
            field_col
        };
        self.table.field_count += 1;

        let col_def = ColumnDefinition::Field(Arc::clone(&field_col));
        self.table
            .columns
            .insert(col_def.clone())
            .expect("no duplicate column");

        self.column_definitions.push(col_def.into());

        Ok(field_col)
    }

    fn next_auto_family_id(&mut self) -> Result<FieldFamilyId> {
        // Check if the current field family still has available slots.
        if let Some(id) = self.table.auto_field_family.as_ref() {

View on GitHub (pinned to 06200ef96b)