JetBrains/intellij-community · error · RuntimeException

Row %d access failed: %s

Error message

Row %d access failed: %s

What it means

tryExtractValueByHierarchicalIndex wraps IndexOutOfBoundsException, NullPointerException and IllegalArgumentException from extractValueByHierarchicalIndex into a RuntimeException prefixed with 'Row %d access failed: %s'. It preserves the cause, so the chained message describes the real traversal failure (out-of-bounds level, null intermediate element, or unsupported collection).

Source

Thrown at grid/core-impl/src/datagrid/HierarchicalColumnsDataGridModel.java:420

  private static void validateHierarchicalIndex(int[] hierarchicalIdx, int rowNum) {
    if (hierarchicalIdx == null) {
      throw new IllegalArgumentException(
        String.format("Row %d failed: hierarchicalIdx cannot be null", rowNum)
      );
    }

    if (hierarchicalIdx.length == 0) {
      throw new IllegalArgumentException(
        String.format("Row %d access failed: hierarchicalIdx cannot be empty", rowNum)
      );
    }
  }

  private static @Nullable Object tryExtractValueByHierarchicalIndex(Object[] topLevelValues, int[] hierarchicalIdx, int rowNum) {
    try {
      return extractValueByHierarchicalIndex(topLevelValues, hierarchicalIdx);
    } catch (IndexOutOfBoundsException | NullPointerException | IllegalArgumentException e) {
      throw new RuntimeException(String.format("Row %d access failed: %s", rowNum, e.getMessage()), e);
    }
  }

  public static Object extractValueByHierarchicalIndex(Object[] topLevelValues, int[] hierarchicalIdx) {
    Object result = null;
    Object[] data = topLevelValues;
    for (int i = 0; i < hierarchicalIdx.length; ++i) {
      int idx = hierarchicalIdx[i];
      if (idx < 0 || idx >= data.length) {
        throw new IndexOutOfBoundsException(
          String.format(
            "Access by hierarchical idx %s failed: Index out of bounds at element by path %s",
            Arrays.toString(hierarchicalIdx),
            Arrays.toString(Arrays.copyOfRange(hierarchicalIdx, 0, i))
          )
        );
      }

View on GitHub (pinned to be881553f2)

Solutions

  1. Read getCause()/the suffix of the message to identify the underlying failure (bounds, null element, bad collection) and fix that condition.
  2. Recompute hierarchical paths from the current columns model instead of caching them across reloads.
  3. Normalize row data so every row has the same nesting shape before display.

Example fix

// before
Object v = getValue(row, stalePath);

// after
try {
  Object v = getValue(row, column.getHierarchicalIdx());
} catch (RuntimeException e) {
  LOG.warn("hierarchical access failed for row " + row.getRowNum(), e.getCause());
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
  Object v = model.getValue(row, path);
} catch (RuntimeException e) {
  Throwable cause = e.getCause() != null ? e.getCause() : e;
  LOG.warn("row " + row.getRowNum() + " path " + Arrays.toString(path) + " failed: " + cause.getMessage());
}

Prevention

When it happens

Trigger: Any hierarchical getValue call whose path does not match the row's actual nested value structure — stale path after row schema changed, path deeper than the data, or intermediate nulls. The original exception's message is embedded in this wrapper's message.

Common situations: Mixed-shape rows (some rows have nested arrays, others flat values); columns restructured while cached paths persist; CSV reload changing nesting depth.

Related errors


AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14). Data as JSON: /api/errors/e14c7f1b5edb1fa1. Report an issue: GitHub.