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 alternation parser ({a,b,c}) throws IllegalStateException when the glob input ends while still inside an unclosed '{' block. The recursive glob() walker consumed the entire input without finding the closing '}'. This indicates a syntactically malformed brace expression.

Source

Thrown at independent-projects/bootstrap/app-model/src/main/java/io/quarkus/util/GlobUtil.java:132

    private static int alternation(String glob, int i, int length, StringBuilder result) {
        result.append("(?:");
        while (i < length) {
            char current = glob.charAt(i++);
            switch (current) {
                case '}':
                    result.append(')');
                    return i;
                case ',':
                    result.append('|');
                    i = glob(glob, i, length, ",}", result);
                    break;
                default:
                    i--;
                    i = glob(glob, i, length, ",}", result);
                    break;
            }
        }
        throw new IllegalStateException(String.format("Missing } at the end of input in glob %s", glob));
    }

    private static int unescape(String glob, int i, int length, StringBuilder result, boolean charClass) {
        if (i < length) {
            final char current = glob.charAt(i++);
            if (charClass) {
                escapeCharClassIfNeeded(current, result);
            } else {
                escapeIfNeeded(current, result);
            }
            return i;
        } else {
            throw new IllegalStateException(
                    String.format("Incomplete escape sequence at the end of input in glob %s", glob));
        }
    }

    private static int charClass(String glob, int i, int length, StringBuilder result) {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Close every '{' with a matching '}': 'src/{main,test}' not 'src/{main,test'
  2. Count braces in the pattern (equal numbers of '{' and '}') before using it
  3. If alternation was unintended, remove the '{' or escape it as '\{'

Example fix

// before
GlobUtil.toRegexPattern("src/{main,test");
// after
GlobUtil.toRegexPattern("src/{main,test}");
Defensive patterns

Strategy: validation

Validate before calling

static boolean bracesBalanced(String glob) {
    int depth = 0;
    for (int i = 0; i < glob.length(); i++) {
        if (glob.charAt(i) == '\\') { i++; continue; }
        char c = glob.charAt(i);
        if (c == '{') depth++;
        else if (c == '}' && --depth < 0) return false;
    }
    return depth == 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

When it happens

Trigger: Passing a glob pattern to GlobUtil with '{' but no matching '}', e.g. 'src/{main,test' or 'a{b,c{d,e}' where an inner closing brace is missing.

Common situations: Hand-written Ant-style patterns in configuration (quarkus properties, resource includes/excludes) with a typo'd or truncated brace; patterns built by string concatenation that dropped the closing '}'; copying a partial pattern from documentation.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/a70737a4d7747b99. Report an issue: GitHub.