JetBrains/intellij-community · error · IllegalStateException

The %s does not support rows addition, use another implement

Error message

The %s does not support rows addition, use another implementation instead.

What it means

StaticNestedTable.addRow(GridRow) always throws IllegalStateException because a static nested table is an immutable snapshot of a query result; rows cannot be appended. The message tells you to use a mutable NestedTable implementation instead.

Source

Thrown at grid/core-impl/src/datagrid/StaticNestedTable.java:101

  @Override
  public String getColumnTypeName(int colIdx) {
    if (!isValidColumnIdx(colIdx)) {
      throw new IllegalStateException("Given column index " + colIdx + " is not valid.");
    }

    TypeMerger merger = determineColumnType(myRowsValues, new int[] { colIdx });
    return merger.getName();
  }

  @Override
  public String getColumnName(int colIdx) {
    return myColumnsHierarchy.getChildren().get(colIdx).getName();
  }

  @Override
  public void addRow(GridRow value) {
    throw new IllegalStateException(
      format("The %s does not support rows addition, use another implementation instead.", this.getClass().getSimpleName())
    );
  }

  @Override
  public @NotNull Iterator<Map<String, Object>> iterator() {
    return new JBIterator<>() {
      private int myNextValueIdx;

      @Override
      protected Map<String, Object> nextImpl() {
        return myNextValueIdx < getRowsNum() ? toMap(myNextValueIdx++) : stop();
      }
    };
  }

  private Map<String, Object> toMap(int rowIdx) {
    ColumnNamesHierarchyNode root = myColumnsHierarchy;

View on GitHub (pinned to be881553f2)

Solutions

  1. Disable row insertion (and append/paste-new-row actions) for grids backed by StaticNestedTable
  2. Branch on mutability before addRow and use a mutable NestedTable implementation for editable datasets
  3. Catch IllegalStateException at the action level and report 'read-only result set' to the user instead of crashing

Example fix

// before
table.addRow(newRow);

// after
if (table.isEditable()) { // or instanceof check for a mutable NestedTable
  table.addRow(newRow);
} else {
  notifyReadOnly();
}
Defensive patterns

Strategy: type-guard

Type guard

boolean isAppendable(NestedTable t) { return !(t instanceof StaticNestedTable); }

Try / catch

catch (IllegalStateException e) if message contains 'does not support rows addition': surface a read-only notification; do not retry

Prevention

When it happens

Trigger: Any call to addRow on a StaticNestedTable instance, e.g. generic editing/paste code that treats every NestedTable uniformly and attempts to append a new record.

Common situations: Grid editing framework trying to insert a new row into a read-only result set; code written against a mutable table implementation later receiving the static one; paste/append actions enabled on a non-editable grid.

Related errors


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