JetBrains/intellij-community · error · IllegalStateException

"Unable to set value. No GridRow found at row index: " + row

Error message

"Unable to set value. No GridRow found at row index: " + rowIdx

What it means

GridWrapperNestedTable.setValueAt(int, int, Object) throws IllegalStateException when the wrapped grid model returns null from getRow(ModelIndex.forRow(model, rowIdx)). The wrapper cannot delegate row.setValue(colIdx, value) without a live GridRow, so a null row at the given view index is a state error (not an argument problem).

Source

Thrown at grid/core-impl/src/datagrid/GridWrapperNestedTable.java:38

  public ColumnNamesHierarchyNode getColumnsHierarchy() {
    return null;
  }

  @Override
  public Object getValueAt(int rowIdx, int colIdx) {
    return myGridModel.getValueAt(ModelIndex.forRow(myGridModel, rowIdx), ModelIndex.forColumn(myGridModel, colIdx));
  }

  @Override
  public Object getValueAt(GridRow row, GridColumn column) {
    return myGridModel.getValueAt(row, column);
  }

  @Override
  public void setValueAt(int rowIdx, int colIdx, Object value) {
    GridRow row = myGridModel.getRow(ModelIndex.forRow(myGridModel, rowIdx));
    if (row == null) {
      throw new IllegalStateException("Unable to set value. No GridRow found at row index: " + rowIdx);
    }
    row.setValue(colIdx, value);
  }

  @Override
  public void addRow(GridRow value) {
    myGridModel.addRow(value);
  }

  @Override
  public int getRowsNum() {
    return myGridModel.getRowCount();
  }

  @Override
  public int getColumnsNum() {
    return myGridModel.getColumnCount();
  }

View on GitHub (pinned to be881553f2)

Solutions

  1. Verify the row exists first: myGridModel.getRow(ModelIndex.forRow(model, rowIdx)) != null, or isValidRowIdx(rowIdx).
  2. Re-obtain the row index from the current selection/event right before writing the value.
  3. Perform model mutation and value write on the same dispatch thread with no intervening refresh.

Example fix

// before
wrapperTable.setValueAt(rowIdx, colIdx, value);

// after
if (wrapperTable.isValidRowIdx(rowIdx)) {
  wrapperTable.setValueAt(rowIdx, colIdx, value);
}
Defensive patterns

Strategy: validation

Validate before calling

if (wrapperTable.isValidRowIdx(rowIdx)) {
  wrapperTable.setValueAt(rowIdx, colIdx, value);
} else {
  LOG.warn("row " + rowIdx + " no longer present; value dropped");
}

Try / catch

try { wrapperTable.setValueAt(rowIdx, colIdx, value); } catch (IllegalStateException e) { // row vanished: user-visible refresh, do not crash LOG.warn(e.getMessage()); }

Prevention

When it happens

Trigger: Calling setValueAt on a row index that is filtered out, beyond the model's row count, or whose row was disposed between UI event and write-back (e.g. after a quick search filter or sorting pass removed it).

Common situations: An editor commit fired after the model was refreshed; setValueAt queued on a background thread while the EDT removed rows; index taken from a stale GridRow reference.

Related errors


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