{"record":{"id":"b73e972172c5ca53","repo":"influxdata/influxdb","slug":"auto-field-family-exists","errorCode":null,"errorMessage":"auto field family exists","messagePattern":"auto field family exists","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"influxdb3_catalog/src/catalog/versions/v2/update.rs","lineNumber":1767,"sourceCode":"        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() {\n            let ffd = self\n                .table\n                .field_families\n                .get_by_id(id)\n                .expect(\"auto field family exists\");\n\n            if ffd.fields.len() < NUM_FIELDS_PER_FAMILY_LIMIT {\n                return Ok(*id);\n            }\n        }\n\n        self.check_field_family_limit()?;\n        let id = self.table.field_families.get_and_increment_next_id();\n        self.table.auto_field_family = Some(id);\n        let auto_id = self.table.next_auto_field_family_name;\n        self.table.next_auto_field_family_name = auto_id + 1;\n        let name = FieldFamilyName::Auto(auto_id);\n\n        let def = FieldFamilyDefinition::new(id, name.clone());\n\n        self.table\n            .field_families\n            .insert(id, Arc::new(def))","sourceCodeStart":1749,"sourceCodeEnd":1785,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_catalog/src/catalog/versions/v2/update.rs#L1749-L1785","documentation":"Panic from `.expect(\"auto field family exists\")` on `self.table.field_families.get_by_id(id)` inside the auto-field-family allocation logic of the v2 catalog update path. `table.auto_field_family` is an Option<id> that must always reference a family present in `field_families`; firing means the pointer is dangling and the table definition is inconsistent.","triggerScenarios":"Adding a field when `auto_field_family` is Some(id) but no family with that id exists in `table.field_families` — e.g. the family was removed without clearing auto_field_family, or the definition op was dropped during partial replay/restore.","commonSituations":"Catalog snapshots restored where field family definitions were pruned but the table's auto pointer remained; hand-edited catalogs; bugs in family deletion logic; WAL replay out of order.","solutions":["Rebuild the table definition from the complete catalog log so the auto family's definition op is reapplied.","Clear or reset `table.auto_field_family` when the referenced family is missing (repair the pointer).","Restore the catalog from a consistent backup.","Report the inconsistency upstream with the affected catalog file/batch."],"exampleFix":"// before\nlet ffd = self.table.field_families.get_by_id(id).expect(\"auto field family exists\");\n// after\nlet ffd = match self.table.field_families.get_by_id(id) {\n    Some(ffd) => ffd,\n    None => { self.table.auto_field_family = None; return self.create_new_auto_field_family(); }\n};","handlingStrategy":"type-guard","validationCode":"// Before using the auto family, verify the pointer is live\nlet ok = table_def.auto_field_family\n    .map(|id| table_def.field_families.get_by_id(&id).is_some())\n    .unwrap_or(true);","typeGuard":"fn auto_family_is_valid(table: &TableDefinition) -> bool {\n    table.auto_field_family.as_ref()\n        .map(|id| table.field_families.get_by_id(id).is_some())\n        .unwrap_or(true)\n}","tryCatchPattern":null,"preventionTips":["Clear auto_field_family whenever its family is removed.","After snapshot restore, validate dangling references in table definitions.","Rebuild table definitions from the full log rather than partial state."],"tags":["influxdb3","catalog","panic","field-family","dangling-reference"],"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"}