jdx/mise · error
glob pattern expands to more than
Error message
glob pattern expands to more than {MAX_BRACE_EXPANSIONS} alternatives: {pattern:?} What it means
To bound memory/work, mise caps brace expansion at MAX_BRACE_EXPANSIONS alternatives. When expand() is about to record more alternatives than the cap (deeply or multiply nested brace groups), it bails instead of expanding, protecting against glob-bomb style inputs.
Solutions
- Split the giant glob into several smaller explicit patterns in the list
- Reduce nesting depth of brace groups (flatten the product manually)
- Replace alternations with wildcards where acceptable (e.g. `src/**` instead of enumerating)
- Generate the explicit file list via a task script instead of one glob
Example fix
// before
sources = ["{a,b}/{a,b}/{a,b}/{a,b}/{a,b}/{a,b}/{a,b}/{a,b}/*.txt"]
// after
sources = ["a/**/*.txt", "b/**/*.txt"] Defensive patterns
Strategy: validation
Validate before calling
python3 -c "import sys,math;p=sys.argv[1];n=1;d=0
for c in p:
if c=='{': d+=1
elif c=='}': d-=1
elif c==',' and d==1: n+=1
print(n)" "$GLOB" Try / catch
alts=$(python3 count_alts.py "$GLOB"); [ "$alts" -lt 100 ] && mise run build || { echo 'too many alternatives; split pattern' >&2; exit 1; } Prevention
- Avoid deeply nested brace groups
- Split combinatorial globs into explicit pattern lists
- Prefer wildcards over enumerating all variants
- Generate file lists via scripts instead of giant globs
When it happens
Trigger: Using a task glob whose brace groups multiply past the cap, e.g. `{a,b}/{a,b}/{a,b}/...` with enough nesting that the product of alternatives exceeds MAX_BRACE_EXPANSIONS.
Common situations: Auto-generated globs from many targets/flavors in task sources or outputs; accidentally writing nested alternations meant to be separate patterns; combinatorial matrices in monorepo task definitions.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- unclosed brace alternate in glob pattern
- unopened brace alternate in glob pattern
- 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/4bb3c822b31ee7fd.
Report an issue: GitHub.
Appendix: source
Thrown at src/task/task_source_checker.rs:145
return Ok(Some(nested));
}
group_start = None;
branches.clear();
}
}
_ => {}
}
}
if group_depth != 0 {
bail!("unclosed brace alternate in glob pattern {pattern:?}");
}
Ok(None)
}
fn expand(pattern: &str, expanded: &mut Vec<String>) -> Result<()> {
let Some(group) = find_group(pattern)? else {
if expanded.len() >= MAX_BRACE_EXPANSIONS {
bail!(
"glob pattern expands to more than {MAX_BRACE_EXPANSIONS} alternatives: {pattern:?}"
);
}
let mut literal = String::with_capacity(pattern.len());
let mut escaped = false;
let mut class_depth = 0;
for ch in pattern.chars() {
if escaped {
escaped = false;
literal.push(ch);
continue;
}
if ch == '\\' && !cfg!(windows) {
escaped = true;
literal.push(ch);
continue;
}
match ch {View on GitHub (pinned to 533346cc37)