{"record":{"id":"d5adaa40b74d9c2c","repo":"risingwavelabs/risingwave","slug":"column-desc-at-index-for-table-id-not-found","errorCode":null,"errorMessage":"column desc at index {} for table id {} not found","messagePattern":"column desc at index (.+?) for table id (.+?) not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/meta/src/controller/catalog/mod.rs","lineNumber":861,"sourceCode":"            .one(&txn)\n            .await?\n            .ok_or_else(|| MetaError::catalog_id_not_found(\"object\", comment.table_id))?;\n\n        let table = if let Some(col_idx) = comment.column_index {\n            let columns: ColumnCatalogArray = Table::find_by_id(comment.table_id)\n                .select_only()\n                .column(table::Column::Columns)\n                .into_tuple()\n                .one(&txn)\n                .await?\n                .ok_or_else(|| MetaError::catalog_id_not_found(\"table\", comment.table_id))?;\n            let mut pb_columns = columns.to_protobuf();\n\n            let column = pb_columns\n                .get_mut(col_idx as usize)\n                .ok_or_else(|| MetaError::catalog_id_not_found(\"column\", col_idx))?;\n            let column_desc = column.column_desc.as_mut().ok_or_else(|| {\n                anyhow!(\n                    \"column desc at index {} for table id {} not found\",\n                    col_idx,\n                    comment.table_id\n                )\n            })?;\n            column_desc.description = comment.description;\n            table::ActiveModel {\n                table_id: Set(comment.table_id),\n                columns: Set(pb_columns.into()),\n                ..Default::default()\n            }\n            .update(&txn)\n            .await?\n        } else {\n            table::ActiveModel {\n                table_id: Set(comment.table_id),\n                description: Set(comment.description),\n                ..Default::default()","sourceCodeStart":843,"sourceCodeEnd":879,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/meta/src/controller/catalog/mod.rs#L843-L879","documentation":"In comment_on, after locating the column by index, the code dereferences column.column_desc to set the description. If the protobuf Column has a None column_desc (the oneof/optional field is unset), the ok_or_else raises this anyhow error naming the index and table id. It indicates catalog corruption or an index that resolved to a column lacking its descriptor.","triggerScenarios":"COMMENT ON COLUMN on a table where pb_columns.get(col_idx) yields a Column whose column_desc field is unset — typically a corrupted or partially-written table catalog, or an internal code path that built columns without descriptors.","commonSituations":"Upgrades/migrations that left column descriptors missing; manually patched catalog data; commenting on columns of internal/implicit tables built through unusual code paths.","solutions":["Verify the table's catalog integrity; re-create or repair the table if its column descriptors are missing.","Re-run the COMMENT operation after fixing/recreating the table.","Report to maintainers if a normal user table hits this — it usually indicates a catalog bug."],"exampleFix":"// before\ncolumn_desc.description = comment.description; // panics/errs if column_desc is None\n// after\nlet column_desc = column.column_desc.as_mut().ok_or_else(|| {\n    anyhow!(\"column desc at index {} for table id {} not found\", col_idx, comment.table_id)\n})?;\ncolumn_desc.description = comment.description;","handlingStrategy":"try-catch","validationCode":"// Rust: verify the column descriptor exists before commenting\nif pb_columns.get(col_idx).and_then(|c| c.column_desc.as_ref()).is_none() {\n    return Err(anyhow!(\"column at index {} has no descriptor; catalog may be corrupted\", col_idx));\n}","typeGuard":"fn has_desc(c: &Option<Column>) -> bool {\n    c.as_ref().and_then(|c| c.column_desc.as_ref()).is_some()\n}","tryCatchPattern":"match controller.comment_on(comment).await {\n    Err(e) if e.to_string().contains(\"column desc\") => {\n        log::error!(\"catalog corruption for table {}: {}\", comment.table_id, e);\n        escalate_or_repair();\n    }\n    other => other?,\n}","preventionTips":["Avoid hand-editing or patching catalog storage.","Verify catalog integrity after upgrades before issuing COMMENT DDL.","Report occurrences on ordinary tables as potential meta bugs."],"tags":["meta","catalog","comment","corruption"],"backgroundTag":"entity-not-found","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}