{"record":{"id":"0f90a980c94d926a","repo":"jdx/mise","slug":"unopened-brace-alternate-in-glob-pattern-pattern","errorCode":null,"errorMessage":"unopened brace alternate in glob pattern {pattern:?}","messagePattern":"unopened brace alternate in glob pattern (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/task/task_source_checker.rs","lineNumber":101,"sourceCode":"                continue;\n            }\n            match ch {\n                '[' if class_depth == 0 => class_depth = 1,\n                ']' if class_depth == 1 => class_depth = 0,\n                '{' if class_depth == 0 => {\n                    if group_depth == 0 {\n                        group_start = Some(idx);\n                        branch_start = idx + ch.len_utf8();\n                    }\n                    group_depth += 1;\n                }\n                ',' if class_depth == 0 && group_depth == 1 => {\n                    branches.push((branch_start, idx));\n                    branch_start = idx + ch.len_utf8();\n                }\n                '}' if class_depth == 0 => {\n                    if group_depth == 0 {\n                        bail!(\"unopened brace alternate in glob pattern {pattern:?}\");\n                    }\n                    group_depth -= 1;\n                    if group_depth == 0 {\n                        let start = group_start.unwrap();\n                        if !branches.is_empty() {\n                            branches.push((branch_start, idx));\n                            return Ok(Some(BraceGroup {\n                                start,\n                                end: idx,\n                                branches,\n                            }));\n                        }\n\n                        // A balanced group without a top-level comma is a\n                        // literal brace pair. It may still contain a nested\n                        // alternate, so look inside it before continuing with\n                        // the remainder of the pattern.\n                        if let Some(mut nested) = find_group(&pattern[start + 1..idx])? {","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/task/task_source_checker.rs#L83-L119","documentation":"mise's custom brace-alternation glob expander scans the pattern character by character, tracking group depth. A '}' encountered while group_depth is 0 means the pattern closes a brace group that was never opened (after escape/class handling), so the pattern is malformed and the expander bails.","triggerScenarios":"Passing a task file glob with an unbalanced '}', e.g. `src/{a,b}` misspelled as `src/a,b}` or with an escaped/opening brace consumed in a character class, into task source/output glob matching.","commonSituations":"Hand-edited globs in mise.toml `__source__`/include patterns; copy-paste truncation dropping the opening '{'; shell or template interpolation eating the opening brace.","solutions":["Fix the pattern so every '}' has a matching '{': `src/{a,b}.rs`","Escape literal braces with backslash if you meant them literally: `\\{a\\}`","Check the character class contents — brackets can swallow the opening brace","Run the glob through a quick local check (e.g. with the same pattern in a shell/bash brace expansion) before committing"],"exampleFix":"// before\nincludes = [\"src/a,b}.rs\"]\n// after\nincludes = [\"src/{a,b}.rs\"]","handlingStrategy":"validation","validationCode":"python3 -c \"import sys;p=sys.argv[1];d=0;esc=False\nfor i,c in enumerate(p):\n  if esc: esc=False; continue\n  if c=='\\\\': esc=True\n  elif c=='{': d+=1\n  elif c=='}': d-=1\n  if d<0: sys.exit('unopened brace')\nsys.exit('unclosed brace' if d else None)\" \"$GLOB\"","typeGuard":null,"tryCatchPattern":"err=$(python3 brace_check.py \"$GLOB\") && { echo \"$err in $GLOB\" >&2; exit 1; } || mise run build","preventionTips":["Balance-check braces after hand-editing globs","Escape literal braces with backslash","Beware character classes swallowing braces","Lint mise.toml glob patterns in CI"],"tags":["glob","tasks","pattern-matching"],"backgroundTag":"invalid-regex-pattern","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}