{"record":{"id":"991d8f6d3668847e","repo":"JetBrains/intellij-community","slug":"access-by-hierarchical-idx-s-failed-encountered-991d8f","errorCode":null,"errorMessage":"Access by hierarchical idx %s failed: Encountered an unexpected nested collection by path %s. Only arrays or lists are allowed as nested collections","messagePattern":"Access by hierarchical idx (.+?) failed: Encountered an unexpected nested collection by path (.+?)\\. Only arrays or lists are allowed as nested collections","errorType":"validation","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"grid/core-impl/src/datagrid/HierarchicalColumnsDataGridModel.java","lineNumber":465,"sourceCode":"            \"Access by hierarchical idx %s failed: Encountered a null element by path %s.\",\n            Arrays.toString(hierarchicalIdx),\n            Arrays.toString(Arrays.copyOfRange(hierarchicalIdx, 0, i))\n          )\n        );\n      }\n\n      if (result instanceof Object[] vals) {\n        data = vals;\n        continue;\n      }\n\n      if (result instanceof List<?> vals) {\n        data = vals.toArray();\n        continue;\n      }\n\n      if (result instanceof Collection) {\n        throw new NullPointerException(\n          String.format(\n            \"Access by hierarchical idx %s failed: Encountered an unexpected nested collection by path %s. Only arrays or lists are allowed as nested collections\",\n            Arrays.toString(hierarchicalIdx),\n            Arrays.toString(Arrays.copyOfRange(hierarchicalIdx, 0, i))\n          )\n        );\n      }\n\n      break;\n    }\n\n    return result;\n  }\n\n  private static int[] addIntToArray(int[] array, int value) {\n    int[] newArray = new int[array.length + 1];\n    System.arraycopy(array, 0, newArray, 0, array.length);\n    newArray[array.length] = value;","sourceCodeStart":447,"sourceCodeEnd":483,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/grid/core-impl/src/datagrid/HierarchicalColumnsDataGridModel.java#L447-L483","documentation":"extractValueByHierarchicalIndex accepts Object[] and List as nested collections but throws (as NullPointerException) when a path level resolves to some other Collection type (e.g. Set, Queue, Collection from a stream). The message states that only arrays or lists are allowed as nested collections.","triggerScenarios":"Row values containing a Set/HashSet or other non-list Collection at a level the hierarchical path traverses; converting JSON/DB data where a nested field was materialized as a Set.","commonSituations":"Data ingestion code that stores arbitrary Java collections into row values; version changes where a producer switched from List to Set for nested elements.","solutions":["Convert nested collections to List or Object[] when building row values (e.g. new ArrayList<>(set) or set.toArray()).","Add an ingestion-time check rejecting/wrapping non-list Collections.","If ordering is irrelevant, sort deterministically before converting to keep paths stable."],"exampleFix":"// before\nvalues[0] = someSet; // Set at nested level\n\n// after\nvalues[0] = new ArrayList<>(someSet); // List is supported","handlingStrategy":"type-guard","validationCode":"Object v = values[level];\nif (v instanceof Collection c && !(v instanceof List)) {\n  v = new ArrayList<>(c); // normalize to supported List\n  values[level] = v;\n}","typeGuard":"static boolean isSupportedNestedValue(Object o) {\n  return o == null || o instanceof Object[] || o instanceof List || !(o instanceof Collection);\n}","tryCatchPattern":null,"preventionTips":["Normalize all nested collections to List/Object[] when constructing row values.","Add ingestion-time assertions that reject Set/Queue at nested levels."],"tags":["datagrid","hierarchical-columns","collections","data-shape"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}