apache/hadoop · error · IllegalArgumentException

Invalid input or indices

Error message

Invalid input or indices

What it means

Error "Invalid input or indices" thrown in apache/hadoop.

Source

Thrown at hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/utils/UriUtils.java:232

    }
    return url;
  }

  /**
   * Replaces the oldString with newString in the baseUrl.
   * It will extract the account url path to make sure we do not replace any
   * matching string in blob path or any other part of url
   * @param baseUrl the url to be updated.
   * @param oldString the string to be replaced.
   * @param newString the string to be replaced with.
   * @return updated URL
   */
  private static String replacedUrl(String baseUrl, String oldString, String newString) {
    int startIndex = baseUrl.toString().indexOf("//") + 2;
    int endIndex = baseUrl.toString().indexOf("/", startIndex);
    if (oldString == null || newString == null|| startIndex < 0
        || endIndex > baseUrl.length() || startIndex > endIndex) {
      throw new IllegalArgumentException("Invalid input or indices");
    }
    StringBuilder sb = new StringBuilder(baseUrl);
    int targetIndex = sb.indexOf(oldString, startIndex);
    if (targetIndex == -1 || targetIndex >= endIndex) {
      return baseUrl; // target not found within the specified range
    }
    sb.replace(targetIndex, targetIndex + oldString.length(), newString);
    return sb.toString();
  }

  /**
   * Checks if the key is for a directory in the set of directories.
   * @param key the key to check.
   * @param dirSet the set of directories.
   * @return true if the key is for a directory in the set of directories.
   */
  public static boolean isKeyForDirectorySet(String key, Set<String> dirSet) {
    for (String dir : dirSet) {

View on GitHub (pinned to 2add963021)

Solutions

  1. Validate the input string and start/end indices passed to the URI utility.
  2. Fix index arithmetic in the calling code.

When it happens

Trigger: UriUtils receives an invalid string or out-of-range indices during parsing.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/fa0addb4e23258da. Report an issue: GitHub.