{"record":{"id":"7572f5dabc1467e2","repo":"JetBrains/intellij-community","slug":"cell-at-coordinate-coord-getrowidx","errorCode":null,"errorMessage":"\"Cell at coordinate [\" + coord.getRowIdx() + \", \" + coord.getColumnIdx() + \"] is not an instance of NestedTable\"","messagePattern":"\"Cell at coordinate \\[\" \\+ coord\\.getRowIdx\\(\\) \\+ \", \" \\+ coord\\.getColumnIdx\\(\\) \\+ \"\\] is not an instance of NestedTable\"","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"grid/core-impl/src/datagrid/NestedTablesDataGridModel.java","lineNumber":35,"sourceCode":"  private final GridListModelBase<GridRow, GridColumn> myModel;\n\n  private final List<NestedTableCellCoordinate> myPathToSelectedNestedTable = new ArrayList<>();\n\n  private NestedTable myCurrentlySelectedNestedTable;\n\n  private final NestedTableCache<GridColumn> myColumnsCache = new NestedTableCache<>(new ColumnCacheStrategy());\n\n  private final NestedTableCache<GridRow> myRowsCache = new NestedTableCache<>(new RowCacheStrategy());\n\n  public NestedTablesDataGridModel(GridListModelBase<GridRow, GridColumn> model) {\n    myModel = model;\n    myCurrentlySelectedNestedTable = new GridWrapperNestedTable(myModel);\n  }\n\n  public void appendSelectedCellCoordinate(@NotNull NestedTableCellCoordinate coord) {\n    Object cellValue = coord.myColumn.getValue(coord.myRow);\n    if (!(cellValue instanceof NestedTable nestedTable)) {\n      throw new IllegalArgumentException(\"Cell at coordinate [\" + coord.getRowIdx() + \", \" + coord.getColumnIdx() + \"] is not an instance of NestedTable\");\n    }\n    myPathToSelectedNestedTable.add(coord);\n    myCurrentlySelectedNestedTable = nestedTable;\n  }\n\n  public @NotNull NestedTableCellCoordinate removeLastNCellCoordinates(int numCellsToRemove) {\n    removeTail(myPathToSelectedNestedTable, numCellsToRemove - 1);\n    int lastIndex = myPathToSelectedNestedTable.size() - 1;\n    NestedTableCellCoordinate cellCoordinateToRestoreScrollPosition = myPathToSelectedNestedTable.remove(lastIndex);\n    updateNestedTableSelection();\n    return cellCoordinateToRestoreScrollPosition;\n  }\n\n  @Override\n  public @NotNull List<NestedTableCellCoordinate> getPathToSelectedNestedTable() {\n    return myPathToSelectedNestedTable;\n  }\n","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/grid/core-impl/src/datagrid/NestedTablesDataGridModel.java#L17-L53","documentation":"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.","triggerScenarios":"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.","commonSituations":"Double-click or 'drill into' action enabled for all cells instead of only NestedTable-valued cells; stale coordinate after model refresh replaced nested content.","solutions":["Before drilling, check the cell value: coord.getColumn().getValue(coord.getRow()) instanceof NestedTable.","Enable the drill-down action only for cells whose current value is a NestedTable.","Re-validate the path stack (myPathToSelectedNestedTable) after any model mutation that can replace cell values."],"exampleFix":"// before\nmodel.appendSelectedCellCoordinate(coord);\n\n// after\nif (coord.getColumn().getValue(coord.getRow()) instanceof NestedTable) {\n  model.appendSelectedCellCoordinate(coord);\n}","handlingStrategy":"type-guard","validationCode":"Object cell = coord.getColumn().getValue(coord.getRow());\nif (cell instanceof NestedTable) {\n  model.appendSelectedCellCoordinate(coord);\n}","typeGuard":"static boolean isDrillableCell(NestedTableCellCoordinate coord) {\n  return coord.getColumn().getValue(coord.getRow()) instanceof NestedTable;\n}","tryCatchPattern":null,"preventionTips":["Enable drill-down actions only when the selected cell currently holds a NestedTable.","Re-check the cell value at action perform time, not just at UI enablement time."],"tags":["datagrid","nested-tables","navigation","type-check"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}