JetBrains/intellij-community · error · IllegalStateException

Column number: %d. Error during setting value in nested tabl

Error message

Column number: %d. Error during setting value in nested table row: column number is out of bounds.

What it means

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.

Source

Thrown at grid/core-impl/src/datagrid/NestedTablesDataGridModel.java:396

    @Override
    public @Nullable Object getValue(int columnNum) {
      if (!myNestedTable.isValidColumnIdx(columnNum)) {
        throw new IllegalStateException(
          String.format("Column number: %d. Error during retrieving value from nested table row: column number is out of bounds.",
                        columnNum));
      }
      return myNestedTable.getValueAt(myRowIdx, columnNum);
    }

    @Override
    public int getSize() {
      return myNestedTable.getColumnsNum();
    }

    @Override
    public void setValue(int i, @Nullable Object object) {
      if (!myNestedTable.isValidColumnIdx(i)) {
        throw new IllegalStateException(
          String.format("Column number: %d. Error during setting value in nested table row: column number is out of bounds.", i));
      }
      myNestedTable.setValueAt(myRowIdx, i, object);
    }

    @Override
    public int getRowNum() {
      return myNestedTable.getRowNum(myRowIdx);
    }
  }

  public static class NestedTableColumn implements GridColumn {
    private final int myColumnIdx;

    private final NestedTable myNestedTable;

    private int myType = Integer.MAX_VALUE;

View on GitHub (pinned to be881553f2)

Solutions

  1. Validate with table.isValidColumnIdx(i) or i < row.getSize() before committing the edit
  2. Re-resolve the column index from the current column model at commit time instead of reusing the index captured at edit start
  3. Discard queued edits when the grid model is refreshed

Example fix

// before
row.setValue(colIdx, newValue);

// after
if (colIdx >= 0 && colIdx < row.getSize()) {
  row.setValue(colIdx, newValue);
}
Defensive patterns

Strategy: validation

Validate before calling

if (editorColumn >= 0 && editorColumn < row.getSize()) {
  row.setValue(editorColumn, newValue);
} else {
  // column vanished during editing; discard edit and refresh
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14). Data as JSON: /api/errors/cdc06e31a28d629f. Report an issue: GitHub.