apache/hadoop · error · PatternSyntaxException

at pos

Error message

%s at pos %d

What it means

Thrown by GlobPattern.error, the shared helper for glob compile failures such as unclosed character classes or groups. Reports the specific syntax error message and the position within the glob where it was detected.

Solutions

  1. Correct the glob pattern at the reported position (unclosed '[' or invalid escape).
  2. Refer to GlobPattern syntax: *, ?, [...], and backslash escapes.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/GlobPattern.java:168 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/GlobPattern.java:168

    if (setOpen > 0) {
      error("Unclosed character class", glob, len);
    }
    if (curlyOpen > 0) {
      error("Unclosed group", glob, len);
    }
    compiled = Pattern.compile(regex.toString(), Pattern.DOTALL);
  }

  /**
   * @return true if this is a wildcard pattern (with special chars)
   */
  public boolean hasWildcard() {
    return hasWildcard;
  }

  private static void error(String message, String pattern, int pos) {
    String fullMessage = String.format("%s at pos %d", message, pos);
    throw new PatternSyntaxException(fullMessage, pattern);
  }
}

View on GitHub (pinned to 2add963021)