jdx/mise · error
':task' pattern should be expanded before matching
Error message
':task' pattern should be expanded before matching
What it means
The `:task` monorepo pattern (current-directory task) is expected to be expanded into a concrete task reference before monorepo pattern matching runs. Reaching the matching function with an unexpanded `:`-prefixed pattern indicates an internal expansion step was skipped — mise treats it as an invariant violation rather than matching incorrectly.
Source
Thrown at src/task/mod.rs:3489
.map(|(_, task)| task)
.unique()
.collect();
if !ext_stripped.is_empty() {
return Ok(ext_stripped);
}
if self.keys().any(|k| k.starts_with("//")) {
return self.get_matching(&format!("//{pat}"));
}
return Ok(vec![]);
}
// === Parse monorepo pattern ===
let normalized_pat = if pat.starts_with("//") {
pat.to_string()
} else if pat.starts_with(':') {
// Special case: :task should have been expanded before calling get_matching
// If we reach here, it means the expansion didn't happen properly
bail!("':task' pattern should be expanded before matching")
} else {
pat.to_string()
};
// Split pattern into path and task parts
// Pattern format: //path/...:task* or //path:task*
let parts: Vec<&str> = normalized_pat.splitn(2, ':').collect();
if pat.starts_with("//") && parts.len() == 1 {
bail!(
"missing task name in monorepo path '{}', use '{}:<task>' or '{}:*' to run all tasks in that path",
pat,
pat,
pat
);
}
let (path_pattern, task_pattern) = match parts.as_slice() {
[path, task] => (*path, *task),
[path] => (*path, "*"),View on GitHub (pinned to afd2eddd3a)
Solutions
- Update mise to the latest version — this usually indicates a bug in the expansion step
- If calling internals, expand `:task` to `//<abs-or-project-relative-path>:task` before invoking get_matching
- Report the issue to mise with the command that produced it (file a bug with reproduction steps)
Example fix
// before (caller code)
get_matching(":build", ...)
// after (caller code)
let expanded = format!("//{}:build", project_relative_dir);
get_matching(&expanded, ...) Defensive patterns
Strategy: retry
Try / catch
# shell if mise run ":build" 2>&1 | grep -q "should be expanded before matching"; then mise upgrade # likely a mise bug; retry on latest fi
Prevention
- Keep mise up to date; this indicates an internal expansion bug, not user error
- Avoid passing raw `:task` selectors to internal/API surfaces from scripts
- Report reproducible occurrences upstream with MISE_DEBUG=1 output
When it happens
Trigger: Calling the internal monorepo pattern matcher `get_matching` with a pattern like `:build` that should have been expanded to `//<current-dir>:build` beforehand; can surface via CLI paths that bypass normal expansion.
Common situations: Mostly an internal/edge-case error; users may see it if tooling (scripts, plugins) invokes task matching APIs with raw `:task` selectors, or from undiscovered code paths after a mise version change.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- relative path syntax '{}' is not supported, use '//{}' or '
- missing task name in monorepo path '{}', use '{}:<task>' or
- affected project exists in graph
- failed to discover workspace providers: {error}
- {err}
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/4c38f897535f7ced.
Report an issue: GitHub.