{"record":{"id":"fde7ece56d061a3b","repo":"JetBrains/intellij-community","slug":"column-index-d-error-during-nested-table-column","errorCode":null,"errorMessage":"Column index: %d. Error during nested table column creation: column index is out of bounds.","messagePattern":"Column index: (.+?)\\. Error during nested table column creation: column index is out of bounds\\.","errorType":"validation","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"grid/core-impl/src/datagrid/NestedTablesDataGridModel.java","lineNumber":420,"sourceCode":"    @Override\n    public int getRowNum() {\n      return myNestedTable.getRowNum(myRowIdx);\n    }\n  }\n\n  public static class NestedTableColumn implements GridColumn {\n    private final int myColumnIdx;\n\n    private final NestedTable myNestedTable;\n\n    private int myType = Integer.MAX_VALUE;\n\n    private String myTypeName = null;\n\n    NestedTableColumn(int columnIdx, NestedTable table) {\n      myNestedTable = table;\n      if (!myNestedTable.isValidColumnIdx(columnIdx)) {\n        throw new IllegalStateException(\n          String.format(\"Column index: %d. Error during nested table column creation: column index is out of bounds.\", columnIdx));\n      }\n      myColumnIdx = columnIdx;\n    }\n\n    @Override\n    public int getColumnNumber() {\n      return myColumnIdx;\n    }\n\n    @Override\n    public int getType() {\n      if (myType == Integer.MAX_VALUE) {\n        myType = myNestedTable.getColumnType(myColumnIdx);\n      }\n      return myType;\n    }\n","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/grid/core-impl/src/datagrid/NestedTablesDataGridModel.java#L402-L438","documentation":"The NestedTableColumn constructor throws IllegalStateException when the given column index fails NestedTable.isValidColumnIdx (negative or >= getColumnsNum()). It prevents creating a GridColumn wrapper for a column the nested table does not have.","triggerScenarios":"Constructing new NestedTableColumn(columnIdx, table) with columnIdx < 0 or >= table.getColumnsNum(); common when a column-model builder iterates a stale column count or the nested table has zero columns.","commonSituations":"Column hierarchy (StaticNestedTable columns) changed between building the column list and wrapping columns; empty nested table while code assumes at least one column; index confusion between hierarchical column position and flat column number.","solutions":["Check table.isValidColumnIdx(columnIdx) before constructing NestedTableColumn","Rebuild column wrappers from the same table snapshot used to read getColumnsNum()","Handle the zero-column nested table case explicitly instead of wrapping columns unconditionally"],"exampleFix":"// before\nGridColumn col = new NestedTablesDataGridModel.NestedTableColumn(idx, table);\n\n// after\nif (table.isValidColumnIdx(idx)) {\n  GridColumn col = new NestedTablesDataGridModel.NestedTableColumn(idx, table);\n}","handlingStrategy":"validation","validationCode":"if (table.isValidColumnIdx(columnIdx)) {\n  GridColumn col = new NestedTablesDataGridModel.NestedTableColumn(columnIdx, table);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build column wrappers in the same pass that reads getColumnsNum()","Handle empty nested tables (0 columns) explicitly","Remember indexes are flat positions under the columns hierarchy, not hierarchy node ids"],"tags":["grid","nested-table","column-index","intellij"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}