{"record":{"id":"59c6cde69d33ad72","repo":"JetBrains/intellij-community","slug":"the-setcolumns-operation-can-only-be-performed-on","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"validation","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"grid/core-impl/src/datagrid/NestedTablesDataGridModel.java","lineNumber":244,"sourceCode":"  }\n\n  @Override\n  public void removeRows(int firstRowIndex, int rowCount) {\n    if (isTopLevelGrid()) {\n      myModel.removeRows(firstRowIndex, rowCount);\n      return;\n    }\n    for (int i = firstRowIndex + rowCount - 1; i >= firstRowIndex; --i) {\n      myCurrentlySelectedNestedTable.removeRow(i);\n    }\n    myRowsCache.clearCache(myCurrentlySelectedNestedTable);\n    updateNestedTableSelection();\n  }\n\n  @Override\n  public void setColumns(@NotNull List<? extends GridColumn> columns) {\n    if (!isTopLevelGrid()) {\n      throw new IllegalStateException(\n        \"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.\");\n    }\n    myModel.setColumns(columns);\n    clearCaches();\n  }\n\n  @Override\n  public void clearColumns() {\n    if (!isTopLevelGrid()) {\n      throw new IllegalStateException(\n        \"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.\");\n    }\n    myModel.clearColumns();\n    clearCaches();\n  }\n\n  @Override\n  public void set(int i, GridRow objects) {","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/grid/core-impl/src/datagrid/NestedTablesDataGridModel.java#L226-L262","documentation":"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.","triggerScenarios":"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.","commonSituations":"Reload/refresh actions firing while a nested table is open; automated pipelines calling setColumns without resetting the nested-table selection first.","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."],"exampleFix":"// before\nmodel.setColumns(newColumns);\n\n// after\nwhile (!model.isTopLevelGrid()) {\n  model.removeLastNCellCoordinates(1);\n}\nmodel.setColumns(newColumns);","handlingStrategy":"validation","validationCode":"if (!model.isTopLevelGrid()) {\n  while (!model.isTopLevelGrid()) model.removeLastNCellCoordinates(1);\n}\nmodel.setColumns(newColumns);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["datagrid","nested-tables","columns","unsupported-operation"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}