jdx/mise · error
unopened brace alternate in glob pattern
Error message
unopened brace alternate in glob pattern {pattern:?} What it means
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.
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
Example fix
// before
includes = ["src/a,b}.rs"]
// after
includes = ["src/{a,b}.rs"] Defensive patterns
Strategy: validation
Validate before calling
python3 -c "import sys;p=sys.argv[1];d=0;esc=False
for i,c in enumerate(p):
if esc: esc=False; continue
if c=='\\': esc=True
elif c=='{': d+=1
elif c=='}': d-=1
if d<0: sys.exit('unopened brace')
sys.exit('unclosed brace' if d else None)" "$GLOB" Try / catch
err=$(python3 brace_check.py "$GLOB") && { echo "$err in $GLOB" >&2; exit 1; } || mise run build Prevention
- Balance-check braces after hand-editing globs
- Escape literal braces with backslash
- Beware character classes swallowing braces
- Lint mise.toml glob patterns in CI
When it happens
Trigger: 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.
Common situations: Hand-edited globs in mise.toml `__source__`/include patterns; copy-paste truncation dropping the opening '{'; shell or template interpolation eating the opening brace.
Related errors
- unclosed brace alternate in glob pattern
- glob pattern expands to more than
- a glob is required
- [bootstrap].config_roots did not match any config roots
- brew-cask: structured copy source must resolve to exactly…
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/0f90a980c94d926a.
Report an issue: GitHub.
Appendix: source
Thrown at src/task/task_source_checker.rs:101
continue;
}
match ch {
'[' if class_depth == 0 => class_depth = 1,
']' if class_depth == 1 => class_depth = 0,
'{' if class_depth == 0 => {
if group_depth == 0 {
group_start = Some(idx);
branch_start = idx + ch.len_utf8();
}
group_depth += 1;
}
',' if class_depth == 0 && group_depth == 1 => {
branches.push((branch_start, idx));
branch_start = idx + ch.len_utf8();
}
'}' if class_depth == 0 => {
if group_depth == 0 {
bail!("unopened brace alternate in glob pattern {pattern:?}");
}
group_depth -= 1;
if group_depth == 0 {
let start = group_start.unwrap();
if !branches.is_empty() {
branches.push((branch_start, idx));
return Ok(Some(BraceGroup {
start,
end: idx,
branches,
}));
}
// A balanced group without a top-level comma is a
// literal brace pair. It may still contain a nested
// alternate, so look inside it before continuing with
// the remainder of the pattern.
if let Some(mut nested) = find_group(&pattern[start + 1..idx])? {View on GitHub (pinned to 533346cc37)