{"record":{"id":"ecfc6ddf022907d2","repo":"JetBrains/intellij-community","slug":"access-by-hierarchical-idx-s-failed-index-out-of","errorCode":null,"errorMessage":"Access by hierarchical idx %s failed: Index out of bounds at element by path %s","messagePattern":"Access by hierarchical idx (.+?) failed: Index out of bounds at element by path (.+?)","errorType":"validation","errorClass":"IndexOutOfBoundsException","httpStatus":null,"severity":"error","filePath":"grid/core-impl/src/datagrid/HierarchicalColumnsDataGridModel.java","lineNumber":430,"sourceCode":"      );\n    }\n  }\n\n  private static @Nullable Object tryExtractValueByHierarchicalIndex(Object[] topLevelValues, int[] hierarchicalIdx, int rowNum) {\n    try {\n      return extractValueByHierarchicalIndex(topLevelValues, hierarchicalIdx);\n    } catch (IndexOutOfBoundsException | NullPointerException | IllegalArgumentException e) {\n      throw new RuntimeException(String.format(\"Row %d access failed: %s\", rowNum, e.getMessage()), e);\n    }\n  }\n\n  public static Object extractValueByHierarchicalIndex(Object[] topLevelValues, int[] hierarchicalIdx) {\n    Object result = null;\n    Object[] data = topLevelValues;\n    for (int i = 0; i < hierarchicalIdx.length; ++i) {\n      int idx = hierarchicalIdx[i];\n      if (idx < 0 || idx >= data.length) {\n        throw new IndexOutOfBoundsException(\n          String.format(\n            \"Access by hierarchical idx %s failed: Index out of bounds at element by path %s\",\n            Arrays.toString(hierarchicalIdx),\n            Arrays.toString(Arrays.copyOfRange(hierarchicalIdx, 0, i))\n          )\n        );\n      }\n\n      result = data[idx];\n\n      if (result == null && i == hierarchicalIdx.length - 1) {\n        return null;\n      }\n      else if (result == null) {\n        throw new NullPointerException(\n          String.format(\n            \"Access by hierarchical idx %s failed: Encountered a null element by path %s.\",\n            Arrays.toString(hierarchicalIdx),","sourceCodeStart":412,"sourceCodeEnd":448,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/grid/core-impl/src/datagrid/HierarchicalColumnsDataGridModel.java#L412-L448","documentation":"Thrown by extractValueByHierarchicalIndex when some level of the hierarchical index is negative or >= the length of the value array at that nesting level. The message includes the full index path and the prefix path at which the failure occurred, making it possible to see exactly which level is out of range.","triggerScenarios":"Passing a path built against a different nesting structure — e.g. [1, 3] where level-1 arrays only have 2 elements; paths computed from column positions that no longer match the row's value layout after a reload.","commonSituations":"Rows with heterogeneous nesting depth; hierarchical columns edited (column moved/removed) so cached paths desync from GridRow.getValues layout.","solutions":["Rebuild the hierarchical index from the live column hierarchy right before access.","Invalidate cached paths whenever columns are set/cleared or the model fires a structure change.","For heterogeneous data, ensure the column hierarchy and value arrays are produced by the same conversion step."],"exampleFix":"// before\nObject v = getValue(row, cachedPath);\n\n// after\nint[] path = currentColumnsModel.idxFor(column); // derived from live hierarchy\nObject v = getValue(row, path);","handlingStrategy":"validation","validationCode":"static boolean pathInBounds(Object[] values, int[] path) {\n  Object[] data = values;\n  for (int idx : path) {\n    if (idx < 0 || idx >= data.length) return false;\n    Object o = data[idx];\n    if (o instanceof Object[] a) data = a;\n    else if (o instanceof List<?> l) data = l.toArray();\n    else return true; // leaf\n  }\n  return true;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate hierarchical indexes and row value arrays in one conversion step so they cannot diverge.","Drop cached paths on any column-structure change."],"tags":["datagrid","hierarchical-columns","index-out-of-bounds","traversal"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}