JetBrains/intellij-community · error · IllegalStateException
Column number: %d. Error during retrieving value from nested
Error message
Column number: %d. Error during retrieving value from nested table row: column number is out of bounds.
What it means
NestedTableRow.getValue(int columnNum) throws IllegalStateException when columnNum fails myNestedTable.isValidColumnIdx, i.e. the requested column does not exist in the nested table. The wrapper refuses to forward the read to NestedTable.getValueAt with a bad index.
Source
Thrown at grid/core-impl/src/datagrid/NestedTablesDataGridModel.java:381
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();
}
@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);View on GitHub (pinned to be881553f2)
Solutions
- Always bound iterations by row.getSize() (which returns the nested table's column count) instead of the outer model's column count
- Call myNestedTable.isValidColumnIdx(columnNum) (or row.getSize() check) before getValue
- Refresh the column model together with the nested table data so indexes stay consistent
Example fix
// before Object v = row.getValue(colIdx); // after Object v = colIdx >= 0 && colIdx < row.getSize() ? row.getValue(colIdx) : null;
Defensive patterns
Strategy: validation
Validate before calling
Object safeGet(GridRow row, int columnNum) {
return (columnNum >= 0 && columnNum < row.getSize()) ? row.getValue(columnNum) : null;
} Try / catch
catch (IllegalStateException e) when(e.getMessage()!=null && e.getMessage().contains("retrieving value from nested table row")): log and return null for that cell Prevention
- Always size column loops from row.getSize() (the nested table's column count), not the outer model's
- Refresh column wrappers and row wrappers from the same table snapshot
- Renderers should tolerate null for out-of-range columns instead of throwing
When it happens
Trigger: Calling GridRow.getValue(columnNum) where columnNum < 0 or columnNum >= table.getColumnsNum(); e.g. renderer/editor querying a column number from an outer/parent model against a nested-table row.
Common situations: Column model and nested table out of sync after a column was removed; using the parent grid's column count to iterate a nested row; stale column index captured before a refresh.
Related errors
- 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."
- Row index: %d. Error during nested table row creation: row i
- 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/ed10c58b8aca7fc7.
Report an issue: GitHub.