JetBrains/intellij-community · error · IllegalStateException
Row index: %d. Error during nested table row creation: row i
Error message
Row index: %d. Error during nested table row creation: row index is invalid.
What it means
Thrown by the NestedTableRow constructor in NestedTablesDataGridModel when the supplied row index fails NestedTable.isValidRowIdx (negative or >= getRowsNum()). It is a fail-fast guard ensuring a GridRow wrapper can never reference a nonexistent row of the nested table.
Source
Thrown at grid/core-impl/src/datagrid/NestedTablesDataGridModel.java:372
public GridColumn getColumn() {
return myColumn;
}
public String getColumnName() {
return myColumn.getName();
}
}
public static class NestedTableRow implements GridRow {
private final int myRowIdx;
private final NestedTable myNestedTable;
NestedTableRow(int rowIdx, NestedTable table) {
myNestedTable = table;
if (!myNestedTable.isValidRowIdx(rowIdx)) {
throw new IllegalStateException(
String.format("Row index: %d. Error during nested table row creation: row index is invalid.", rowIdx));
}
myRowIdx = rowIdx;
}
@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();View on GitHub (pinned to be881553f2)
Solutions
- Re-fetch the nested table (rows/columns) right before creating row wrappers so indexes match the current getRowsNum()
- Check table.isValidRowIdx(rowIdx) before constructing NestedTableRow and skip/handle invalid indexes
- Audit loops for off-by-one (use '< getRowsNum()', not '<=')
- If the table can mutate concurrently, synchronize access or snapshot rows under the grid model lock
Example fix
// before
GridRow row = new NestedTablesDataGridModel.NestedTableRow(cachedIdx, table);
// after
if (table.isValidRowIdx(cachedIdx)) {
GridRow row = new NestedTablesDataGridModel.NestedTableRow(cachedIdx, table);
} Defensive patterns
Strategy: validation
Validate before calling
if (table == null || !table.isValidRowIdx(rowIdx)) {
// refresh snapshot or skip this row
return;
}
NestedTablesDataGridModel.NestedTableRow row = new NestedTablesDataGridModel.NestedTableRow(rowIdx, table); Prevention
- Never cache row indexes across dataset refreshes; re-read getRowsNum() before wrapping rows
- Iterate with rowIdx < table.getRowsNum(), never <=
- Treat nested tables as snapshots: create all row wrappers from one consistent read
When it happens
Trigger: Calling new NestedTableRow(rowIdx, table) (directly or via model code that wraps nested-table rows) with rowIdx < 0 or rowIdx >= table.getRowsNum(); typically after the nested table shrank between reading its size and creating row wrappers.
Common situations: Stale row indexes cached from a previous result set; concurrent dataset refresh shrinking the nested table; off-by-one loops iterating 0..=getRowsNum().
Related errors
- Column number: %d. Error during retrieving value from nested
- Column number: %d. Error during setting value in nested tabl
- Column index: %d. Error during nested table column creation:
- "Given column index " + colIdx + " is not valid."
- The %s does not support rows addition, use another implement
AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14).
Data as JSON: /api/errors/dbe292d07c68c25f.
Report an issue: GitHub.