JetBrains/intellij-community · error · IllegalArgumentException

"Cell at coordinate [" + coord.getRowIdx() + ", " + coord.ge

Error message

"Cell at coordinate [" + coord.getRowIdx() + ", " + coord.getColumnIdx() + "] is not an instance of NestedTable"

What it means

NestedTablesDataGridModel.appendSelectedCellCoordinate throws IllegalArgumentException when the cell at the given NestedTableCellCoordinate does not hold a NestedTable value. Drilling into a nested grid is only possible for cells whose value is itself a nested table; the model checks the live cell value (coord.myColumn.getValue(coord.myRow)) before pushing the coordinate onto the navigation path.

Source

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

  private final GridListModelBase<GridRow, GridColumn> myModel;

  private final List<NestedTableCellCoordinate> myPathToSelectedNestedTable = new ArrayList<>();

  private NestedTable myCurrentlySelectedNestedTable;

  private final NestedTableCache<GridColumn> myColumnsCache = new NestedTableCache<>(new ColumnCacheStrategy());

  private final NestedTableCache<GridRow> myRowsCache = new NestedTableCache<>(new RowCacheStrategy());

  public NestedTablesDataGridModel(GridListModelBase<GridRow, GridColumn> model) {
    myModel = model;
    myCurrentlySelectedNestedTable = new GridWrapperNestedTable(myModel);
  }

  public void appendSelectedCellCoordinate(@NotNull NestedTableCellCoordinate coord) {
    Object cellValue = coord.myColumn.getValue(coord.myRow);
    if (!(cellValue instanceof NestedTable nestedTable)) {
      throw new IllegalArgumentException("Cell at coordinate [" + coord.getRowIdx() + ", " + coord.getColumnIdx() + "] is not an instance of NestedTable");
    }
    myPathToSelectedNestedTable.add(coord);
    myCurrentlySelectedNestedTable = nestedTable;
  }

  public @NotNull NestedTableCellCoordinate removeLastNCellCoordinates(int numCellsToRemove) {
    removeTail(myPathToSelectedNestedTable, numCellsToRemove - 1);
    int lastIndex = myPathToSelectedNestedTable.size() - 1;
    NestedTableCellCoordinate cellCoordinateToRestoreScrollPosition = myPathToSelectedNestedTable.remove(lastIndex);
    updateNestedTableSelection();
    return cellCoordinateToRestoreScrollPosition;
  }

  @Override
  public @NotNull List<NestedTableCellCoordinate> getPathToSelectedNestedTable() {
    return myPathToSelectedNestedTable;
  }

View on GitHub (pinned to be881553f2)

Solutions

  1. Before drilling, check the cell value: coord.getColumn().getValue(coord.getRow()) instanceof NestedTable.
  2. Enable the drill-down action only for cells whose current value is a NestedTable.
  3. Re-validate the path stack (myPathToSelectedNestedTable) after any model mutation that can replace cell values.

Example fix

// before
model.appendSelectedCellCoordinate(coord);

// after
if (coord.getColumn().getValue(coord.getRow()) instanceof NestedTable) {
  model.appendSelectedCellCoordinate(coord);
}
Defensive patterns

Strategy: type-guard

Validate before calling

Object cell = coord.getColumn().getValue(coord.getRow());
if (cell instanceof NestedTable) {
  model.appendSelectedCellCoordinate(coord);
}

Type guard

static boolean isDrillableCell(NestedTableCellCoordinate coord) {
  return coord.getColumn().getValue(coord.getRow()) instanceof NestedTable;
}

Prevention

When it happens

Trigger: Calling appendSelectedCellCoordinate for a regular (scalar) cell; a drill-down attempted after the cell's value was edited from a nested table to a plain value; a coordinate built for the wrong row/column pair.

Common situations: Double-click or 'drill into' action enabled for all cells instead of only NestedTable-valued cells; stale coordinate after model refresh replaced nested content.

Related errors


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