jdx/mise · error
Cannot use :task syntax outside of monorepo root directory
Error message
Cannot use :task syntax outside of monorepo root directory
What it means
With a monorepo root configured, a colon pattern must resolve to a scope: mise computes the nearest project root (config dir or declared [monorepo].config_roots) at or above cwd, bounded by the monorepo root. If cwd is not under any such scope — i.e. you are outside the monorepo directory tree — the ':' pattern cannot be expanded and mise errors. Bare names silently pass through for global matching.
Source
Thrown at src/task/task_load_context.rs:247
.collect();
cwd.ancestors()
.find(|a| *a == monorepo_root || roots.iter().any(|r| r == a))
.unwrap_or(cwd)
} else {
cwd
};
if let Some(scope) = monorepo_scope(&monorepo_root, scope_dir) {
// For bare task names, only expand if we're actually in the monorepo
// For colon patterns, always expand (and error if outside monorepo)
if is_colon_pattern {
Ok(format!("{scope}{task}"))
} else {
Ok(format!("{scope}:{task}"))
}
} else {
if is_colon_pattern {
bail!("Cannot use :task syntax outside of monorepo root directory");
}
// Bare name outside monorepo - return as-is for global matching
Ok(task.to_string())
}
} else {
if is_colon_pattern {
bail!("Cannot use :task syntax without a current working directory");
}
Ok(task.to_string())
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_monorepo_scope() {View on GitHub (pinned to 9dcfcaa0dc)
Solutions
- cd into a directory under the monorepo root (ideally inside the target package) and rerun.
- Use the absolute form `mise //pkg:build` which does not depend on cwd scoping.
- Use the bare task name `mise build` for global matching.
- If the monorepo root was mis-detected, check MISE_CONFIG_FILE / MISE_GLOBAL_CONFIG_FILE env overrides.
Example fix
# before (cwd=/tmp) $ mise :build error: Cannot use :task syntax outside of monorepo root directory # after $ cd /repo/packages/web && mise :build # or $ mise //packages/web:build
Defensive patterns
Strategy: validation
Validate before calling
# ensure cwd is inside the repo before :task
pwd | grep -q "^$REPO_ROOT" || { echo 'run from inside the monorepo' >&2; exit 1; }
mise :build Prevention
- Run tasks from inside the monorepo; use //pkg:task from outside.
- Beware MISE_CONFIG_FILE pulling a monorepo config into unrelated cwd.
When it happens
Trigger: Running `mise :build` with cwd outside the monorepo root directory (e.g. the monorepo root is /repo but cwd is /other, or cwd is in a directory excluded from config_roots); invoking from a scratch/tmp directory while a monorepo-root config is still in scope (e.g. via MISE_CONFIG_FILE or global config).
Common situations: cd-ing elsewhere then running mise with the monorepo config still attached via env vars; monorepo root detected from a config in a parent of HOME-like paths; scripts that compute cwd incorrectly.
Related errors
- relative path syntax '{}' is not supported, use '//{}' or ':
- Cannot use :task syntax without a monorepo root
- Cannot use :task syntax without a current working directory
- Monorepo task paths (like `//path:task` or `:task`) require
- no tasks defined in {}. Are you in a project directory?
AI-assisted analysis of jdx/mise@9dcfcaa0dc (2026-08-17).
Data as JSON: /api/errors/abf220daf6714a9c.
Report an issue: GitHub.