JetBrains/intellij-community · error · IllegalStateException
The setColumns operation can only be performed on top-level
Error message
The setColumns operation can only be performed on top-level tables. Nested tables do not support this operation because the column structure of nested tables is encapsulated within the nested table object.
What it means
NestedTablesDataGridModel.setColumns throws IllegalStateException when a nested table is currently selected. Column structure of nested tables lives inside the NestedTable value itself, so replacing the top-level column list from within a drilled-down view is disallowed.
Source
Thrown at grid/core-impl/src/datagrid/NestedTablesDataGridModel.java:244
}
@Override
public void removeRows(int firstRowIndex, int rowCount) {
if (isTopLevelGrid()) {
myModel.removeRows(firstRowIndex, rowCount);
return;
}
for (int i = firstRowIndex + rowCount - 1; i >= firstRowIndex; --i) {
myCurrentlySelectedNestedTable.removeRow(i);
}
myRowsCache.clearCache(myCurrentlySelectedNestedTable);
updateNestedTableSelection();
}
@Override
public void setColumns(@NotNull List<? extends GridColumn> columns) {
if (!isTopLevelGrid()) {
throw new IllegalStateException(
"The setColumns operation can only be performed on top-level tables. Nested tables do not support this operation because the column structure of nested tables is encapsulated within the nested table object.");
}
myModel.setColumns(columns);
clearCaches();
}
@Override
public void clearColumns() {
if (!isTopLevelGrid()) {
throw new IllegalStateException(
"The setColumns operation can only be performed on top-level tables. Nested tables do not support this operation because the column structure of nested tables is encapsulated within the nested table object.");
}
myModel.clearColumns();
clearCaches();
}
@Override
public void set(int i, GridRow objects) {View on GitHub (pinned to be881553f2)
Solutions
- Exit the nested view first (clear nested selection / pop path coordinates) before setColumns.
- Guard with isTopLevelGrid() and defer or queue the column update until the user returns to the top level.
- For a full reload, reset the whole nested-navigation state instead of only swapping columns.
Example fix
// before
model.setColumns(newColumns);
// after
while (!model.isTopLevelGrid()) {
model.removeLastNCellCoordinates(1);
}
model.setColumns(newColumns); Defensive patterns
Strategy: validation
Validate before calling
if (!model.isTopLevelGrid()) {
while (!model.isTopLevelGrid()) model.removeLastNCellCoordinates(1);
}
model.setColumns(newColumns); Prevention
- Exit the nested view (pop all coordinates) before any schema mutation.
- Defer column updates triggered by background reloads until the top-level view is active.
When it happens
Trigger: Calling setColumns(columns) while the user is inside a nested grid (navigation path non-empty), e.g. a schema-refresh routine that does not account for drill-down state.
Common situations: Reload/refresh actions firing while a nested table is open; automated pipelines calling setColumns without resetting the nested-table selection first.
Related errors
- Operation is not permitted for nested grids.
- "Given column index " + colIdx + " is not valid."
- "Cell at coordinate [" + coord.getRowIdx() + ", " + coord.ge
- "Given column index " + colIdx + " is not valid."
- Invalid given row index: %d. Index should be in range from 0
AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14).
Data as JSON: /api/errors/59c6cde69d33ad72.
Report an issue: GitHub.