apple/pkl · error · InvalidGlobPatternException
invalidGlobUnsupportedFeature
invalidGlobUnsupportedFeature
Error message
invalidGlobUnsupportedFeature
What it means
Glob character classes do not support POSIX-style `[:...:]`, collating `[=...=]`, or class `[.Quickly.]` extensions. consumeCharacterClass throws this error when it sees `[` followed by `:`, `=`, or `.` inside a character class.
Source
Thrown at pkl-core/src/main/java/org/pkl/core/util/GlobResolver.java:119
sb.append("^");
i++;
}
case ']' -> {
// the first `]` in a character class is verbatim and not treated as a closing delimiter.
sb.append(']');
i++;
}
case NULL ->
throw new InvalidGlobPatternException(
ErrorMessages.create("invalidGlobMissingCharacterClassTerminator"));
}
i++;
var current = globPattern.charAt(i);
while (current != ']') {
if (current == '[') {
var next = getNextChar(globPattern, i);
if (next == ':' || next == '=' || next == '.') {
throw new InvalidGlobPatternException(
ErrorMessages.create("invalidGlobUnsupportedFeature"));
}
}
if (current == '/') {
throw new InvalidGlobPatternException(
ErrorMessages.create("invalidGlobInvalidCharacterInCharacterClass", current));
} else if (current == '\\') {
sb.append("\\\\");
} else {
sb.append(current);
}
i++;
if (i == globPattern.length()) {
throw new InvalidGlobPatternException(
ErrorMessages.create("invalidGlobMissingCharacterClassTerminator"));
}
current = globPattern.charAt(i);
}View on GitHub (pinned to f3efcbfc9b)
Solutions
- Remove the POSIX-style class extension and enumerate the characters explicitly (e.g. `[a-zA-Z]` instead of `[[:alpha:]]`).
- Replace with an equivalent alternation group `{a,b,c}` if supported.
- Use a plain regex-based matcher if POSIX classes are essential.
Example fix
// before glob = "file[[:digit:]]*.txt" // after glob = "file[0123456789]*.txt"
Defensive patterns
Strategy: validation
Validate before calling
if (glob.matches(".*\\[\\[:.*\\].*")) throw new IllegalArgumentException("POSIX classes unsupported in glob: " + glob);
Try / catch
try { return GlobResolver.toRegexPattern(glob); } catch (InvalidGlobPatternException e) { throw new IllegalArgumentException("Unsupported glob feature in: " + glob, e); }
Prevention
- Enumerate characters explicitly instead of POSIX classes.
- Don't paste regex/fnmatch-flavored patterns into globs.
- Document supported glob syntax for users.
When it happens
Trigger: Using POSIX character-class syntax like `[[:alpha:]]`, `[=e=]`, or `[.a.]` inside a glob passed to GlobResolver.toRegexString/toRegexPattern.
Common situations: Porting patterns from shell/POSIX fnmatch or find utilities that support these extensions; copying regex-flavored patterns into globs.
Related errors
- invalidGlobNestedSubpattern
- invalidGlobPattern
- invalidGlobMissingCharacterClassTerminator
- invalidGlobInvalidCharacterInCharacterClass
- invalidGlobInvalidTerminatingCharacter
AI-assisted analysis of apple/pkl@f3efcbfc9b (2026-09-08).
Data as JSON: /api/errors/8b3b08309b713ce7.
Report an issue: GitHub.