{"record":{"id":"cdc06e31a28d629f","repo":"JetBrains/intellij-community","slug":"column-number-d-error-during-setting-value-in-n","errorCode":null,"errorMessage":"Column number: %d. Error during setting value in nested table row: column number is out of bounds.","messagePattern":"Column number: (.+?)\\. Error during setting value in nested table row: column number is out of bounds\\.","errorType":"validation","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"grid/core-impl/src/datagrid/NestedTablesDataGridModel.java","lineNumber":396,"sourceCode":"    @Override\n    public @Nullable Object getValue(int columnNum) {\n      if (!myNestedTable.isValidColumnIdx(columnNum)) {\n        throw new IllegalStateException(\n          String.format(\"Column number: %d. Error during retrieving value from nested table row: column number is out of bounds.\",\n                        columnNum));\n      }\n      return myNestedTable.getValueAt(myRowIdx, columnNum);\n    }\n\n    @Override\n    public int getSize() {\n      return myNestedTable.getColumnsNum();\n    }\n\n    @Override\n    public void setValue(int i, @Nullable Object object) {\n      if (!myNestedTable.isValidColumnIdx(i)) {\n        throw new IllegalStateException(\n          String.format(\"Column number: %d. Error during setting value in nested table row: column number is out of bounds.\", i));\n      }\n      myNestedTable.setValueAt(myRowIdx, i, object);\n    }\n\n    @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","sourceCodeStart":378,"sourceCodeEnd":414,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/grid/core-impl/src/datagrid/NestedTablesDataGridModel.java#L378-L414","documentation":"NestedTableRow.setValue(int i, Object object) throws IllegalStateException when the column index i fails isValidColumnIdx for the nested table. It guards the write path (NestedTable.setValueAt) symmetrically with the read path.","triggerScenarios":"An editor committing an edited value via row.setValue(i, value) with i outside 0..getColumnsNum()-1; typically the editor's column index comes from a column model that has drifted from the nested table.","commonSituations":"Applying an edit after the result set was re-queried and columns changed; applying a stored edit (paste, bulk update) against a newer table snapshot; off-by-one in column loops.","solutions":["Validate with table.isValidColumnIdx(i) or i < row.getSize() before committing the edit","Re-resolve the column index from the current column model at commit time instead of reusing the index captured at edit start","Discard queued edits when the grid model is refreshed"],"exampleFix":"// before\nrow.setValue(colIdx, newValue);\n\n// after\nif (colIdx >= 0 && colIdx < row.getSize()) {\n  row.setValue(colIdx, newValue);\n}","handlingStrategy":"validation","validationCode":"if (editorColumn >= 0 && editorColumn < row.getSize()) {\n  row.setValue(editorColumn, newValue);\n} else {\n  // column vanished during editing; discard edit and refresh\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Re-resolve the column index from the live column model at commit time","Cancel in-flight editors when the grid model is refreshed","Validate against row.getSize() (nested column count) before every setValue"],"tags":["grid","nested-table","column-index","editing","intellij"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}