{"record":{"id":"5eb659ae615b38f9","repo":"quarkusio/quarkus","slug":"missing-at-the-end-of-input-in-glob-s-5eb659","errorCode":null,"errorMessage":"Missing ] at the end of input in glob %s","messagePattern":"Missing \\] at the end of input in glob (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/app-model/src/main/java/io/quarkus/util/GlobUtil.java","lineNumber":173,"sourceCode":"        }\n        while (i < length) {\n            char current = glob.charAt(i++);\n            switch (current) {\n                case ']':\n                    result.append(\"]]\");\n                    return i;\n                case '-':\n                    result.append('-');\n                    break;\n                case '\\\\':\n                    i = unescape(glob, i, length, result, true);\n                    break;\n                default:\n                    escapeCharClassIfNeeded(current, result);\n                    break;\n            }\n        }\n        throw new IllegalStateException(String.format(\"Missing ] at the end of input in glob %s\", glob));\n    }\n\n    private static void escapeIfNeeded(char current, StringBuilder result) {\n        switch (current) {\n            case '*':\n            case '?':\n            case '+':\n            case '.':\n            case '^':\n            case '$':\n            case '{':\n            case '[':\n            case ']':\n            case '|':\n            case '(':\n            case ')':\n            case '\\\\':\n                result.append('\\\\');","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/app-model/src/main/java/io/quarkus/util/GlobUtil.java#L155-L191","documentation":"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.","triggerScenarios":"Passing a glob with '[' but no ']', e.g. 'file[0-9' or 'a[!bc' ; charClass() is entered from glob() whenever '[' is encountered.","commonSituations":"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.","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"],"exampleFix":"// before\nGlobUtil.toRegexPattern(\"file[0-9\");\n// after\nGlobUtil.toRegexPattern(\"file[0-9]\");","handlingStrategy":"validation","validationCode":"static boolean bracketsBalanced(String glob) {\n    int open = 0;\n    for (int i = 0; i < glob.length(); i++) {\n        if (glob.charAt(i) == '\\\\') { i++; continue; }\n        if (glob.charAt(i) == '[') open++;\n        else if (glob.charAt(i) == ']' && open > 0) open--;\n    }\n    return open == 0;\n}","typeGuard":null,"tryCatchPattern":"try {\n    return GlobUtil.toRegexPattern(glob);\n} catch (IllegalStateException e) {\n    if (e.getMessage().startsWith(\"Missing ]\")) {\n        throw new IllegalArgumentException(\"Unclosed '[' in glob: \" + glob, e);\n    }\n    throw e;\n}","preventionTips":["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"],"tags":["glob","parsing","configuration"],"backgroundTag":"unclosed-glob-brace","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}