{"record":{"id":"570e89fa714bd996","repo":"influxdata/influxdb","slug":"field-does-not-exist","errorCode":null,"errorMessage":"field does not exist","messagePattern":"field does not exist","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"influxdb3_catalog/src/catalog/versions/v2/update.rs","lineNumber":1744,"sourceCode":"            }\n        };\n\n        let col_id = self.next_legacy_column_id()?;\n        let field_col = {\n            let ffd_arc = self\n                .table\n                .field_families\n                .get_mut_by_id(&ff_id)\n                .expect(\"field family name exists\");\n\n            // Use `Arc::make_mut` because `TableTransaction`s are created via cloning\n            // `TableDefinition`s.\n            let ffd = Arc::make_mut(ffd_arc);\n            let id = FieldIdentifier::new(ffd.id, ffd.fields.get_and_increment_next_id());\n            let field_col = Arc::new(FieldColumn::new(id, col_id, name.as_ref(), data_type));\n            ffd.fields\n                .insert(id.1, Arc::clone(&field_col))\n                .expect(\"field does not exist\");\n            field_col\n        };\n        self.table.field_count += 1;\n\n        let col_def = ColumnDefinition::Field(Arc::clone(&field_col));\n        self.table\n            .columns\n            .insert(col_def.clone())\n            .expect(\"no duplicate column\");\n\n        self.column_definitions.push(col_def.into());\n\n        Ok(field_col)\n    }\n\n    fn next_auto_family_id(&mut self) -> Result<FieldFamilyId> {\n        // Check if the current field family still has available slots.\n        if let Some(id) = self.table.auto_field_family.as_ref() {","sourceCodeStart":1726,"sourceCodeEnd":1762,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_catalog/src/catalog/versions/v2/update.rs#L1726-L1762","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check that field-add operations are applied exactly once per catalog sequence number.","Verify the family's persisted next-field-id counter is greater than all existing field ids in the snapshot/log.","Restore the catalog from a backup predating the corruption.","Report upstream with the failing batch if hit via supported influxdb3 APIs."],"exampleFix":"// before\nffd.fields.insert(id.1, Arc::clone(&field_col)).expect(\"field does not exist\");\n// after\nif ffd.fields.contains_key(&id.1) {\n    return Err(Error::DuplicateField { family: ffd.id, field_id: id.1 });\n}\nffd.fields.insert(id.1, Arc::clone(&field_col)).expect(\"field does not exist\");","handlingStrategy":"validation","validationCode":"// Ensure the family's next-field-id counter is past all existing fields\nlet next = ffd.fields.get_and_increment_next_id();\nif ffd.fields.contains_key(&next) {\n    return Err(\"corrupt next-field-id counter; rebuild family from log\");\n}","typeGuard":"fn counter_is_sane(ffd: &FieldFamilyDefinition) -> bool {\n    ffd.fields.keys().all(|k| *k < ffd.next_field_id())\n}","tryCatchPattern":null,"preventionTips":["Apply each field-add op exactly once; dedupe replays by sequence number.","After restoring snapshots, validate the next-field-id counter exceeds all stored ids.","Avoid hand-merging field family logs."],"tags":["influxdb3","catalog","panic","field","duplicate-key"],"backgroundTag":"internal-invariant-violation","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}