quarkusio/quarkus · error · IllegalStateException
Missing ] at the end of input in glob %s
Error message
Missing ] at the end of input in glob %s
What it means
GlobUtil's character-class parser ([abc]) throws IllegalStateException when the input ends inside an unclosed '['. The charClass() loop consumes characters until it finds ']', and hitting end-of-input first means the bracket expression is unterminated.
Source
Thrown at independent-projects/bootstrap/app-model/src/main/java/io/quarkus/util/GlobUtil.java:173
}
while (i < length) {
char current = glob.charAt(i++);
switch (current) {
case ']':
result.append("]]");
return i;
case '-':
result.append('-');
break;
case '\\':
i = unescape(glob, i, length, result, true);
break;
default:
escapeCharClassIfNeeded(current, result);
break;
}
}
throw new IllegalStateException(String.format("Missing ] at the end of input in glob %s", glob));
}
private static void escapeIfNeeded(char current, StringBuilder result) {
switch (current) {
case '*':
case '?':
case '+':
case '.':
case '^':
case '$':
case '{':
case '[':
case ']':
case '|':
case '(':
case ')':
case '\\':
result.append('\\');View on GitHub (pinned to e1c734241f)
Solutions
- Add the closing ']': 'file[0-9]' not 'file[0-9'
- If '[' is meant literally, escape it as '\['
- Validate bracket balance (equal '[' and ']' counts, ignoring escaped ones) before applying the glob
Example fix
// before
GlobUtil.toRegexPattern("file[0-9");
// after
GlobUtil.toRegexPattern("file[0-9]"); Defensive patterns
Strategy: validation
Validate before calling
static boolean bracketsBalanced(String glob) {
int open = 0;
for (int i = 0; i < glob.length(); i++) {
if (glob.charAt(i) == '\\') { i++; continue; }
if (glob.charAt(i) == '[') open++;
else if (glob.charAt(i) == ']' && open > 0) open--;
}
return open == 0;
} Try / catch
try {
return GlobUtil.toRegexPattern(glob);
} catch (IllegalStateException e) {
if (e.getMessage().startsWith("Missing ]")) {
throw new IllegalArgumentException("Unclosed '[' in glob: " + glob, e);
}
throw e;
} Prevention
- Validate '[' / ']' balance before applying user-supplied globs
- Escape literal '[' as '\[' when a character class is not intended
- Test glob patterns coming from config with the actual GlobUtil before shipping
When it happens
Trigger: Passing a glob with '[' but no ']', e.g. 'file[0-9' or 'a[!bc' ; charClass() is entered from glob() whenever '[' is encountered.
Common situations: Malformed include/exclude patterns in Quarkus config where ']' was accidentally deleted; patterns where the intended ']' was escaped or consumed by an earlier parsing bug; writing classes with a hyphen or '!' and forgetting to close them.
Related errors
- Missing } at the end of input in glob %s
- Invalid duration: ${value}
- Invalid server address
- Mismatched braces:
- Incomplete escape sequence at the end of input in glob %s
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/5eb659ae615b38f9.
Report an issue: GitHub.