jdx/mise · error
source pattern did not match
Error message
source pattern did not match {path} What it means
wildcard_captures compiles a dotfile source pattern (with wildcards) into a regex and matches a concrete path against it. If the path does not match the pattern — e.g. after a wildcard expansion where the enumerated path diverges from the pattern — it bails with this message instead of producing captures.
Solutions
- Check that the source pattern's wildcards actually cover the reported path.
- Normalize the path (remove symlinks/`..`) or adjust the pattern to the real directory layout.
- Re-run the dotfiles apply so globbing and matching happen against a consistent tree.
Example fix
// before
"~/.config/app/*" = { source = "dotfiles/app/*.yml" } // files are actually .yaml
// after
"~/.config/app/*" = { source = "dotfiles/app/*.yaml" } Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check the pattern against real paths before apply:
for path in candidate_paths {
assert!(wildcard_regex(pattern).unwrap().is_match(&normalize(path)),
"pattern {pattern} does not cover {path}");
} Try / catch
match dotfiles_apply() {
Err(e) if e.to_string().contains("source pattern did not match") => {
// inspect pattern vs path and fix the glob
}
other => other?,
} Prevention
- Avoid symlinks and .. inside wildcarded source trees.
- Keep glob patterns and directory extensions in sync (.conf vs .yaml).
- Test wildcard entries with `mise dotfiles status` before apply.
When it happens
Trigger: Expanding a wildcard dotfile source (e.g. pattern `dotfiles/config/*.conf`) where an enumerated candidate path fails to re-match the pattern, typically due to path separator normalization differences or a path discovered outside the pattern's scope.
Common situations: Symlinks or `..` segments producing a path that no longer matches the glob; mixing `\` and `/` on Windows; a source directory that changed between globbing and capture (race or stale cache).
Related errors
- a glob is required
- dotfile cannot declare both source and content
- dotfile : inline content does not support mode, exclude, or…
- dotfile target must be absolute or start with ~/
- failed to list Git-tracked files in
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/d3a3637b1f185292.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/files.rs:1365
policy,
variants: vec![],
enabled,
})
})
.collect()
}
fn is_glob_pattern(path: &Path) -> bool {
path.to_string_lossy()
.chars()
.any(|c| matches!(c, '*' | '?' | '['))
}
fn wildcard_captures(pattern: &str, path: &Path) -> Result<Vec<String>> {
let path = normalize_path_separators(&path.to_string_lossy());
let re = wildcard_regex(pattern)?;
let Some(captures) = re.captures(&path) else {
bail!("source pattern did not match {path}");
};
Ok((1..captures.len())
.map(|i| {
captures
.get(i)
.map(|m| m.as_str().to_string())
.unwrap_or_default()
})
.collect())
}
fn wildcard_regex(pattern: &str) -> Result<Regex> {
let mut re = String::from("^");
let pattern = normalize_path_separators(pattern);
let mut chars = pattern.chars().peekable();
while let Some(ch) = chars.next() {
match ch {
'*' if chars.peek() == Some(&'*') => {View on GitHub (pinned to 533346cc37)