jdx/mise · error

Cannot use :task syntax without a monorepo root

Error message

Cannot use :task syntax without a monorepo root

What it means

When expanding a colon pattern (`:task`), mise requires a config file marked as the monorepo root (config_files value with monorepo_root() == Some(true) and a project root). If none of the configs in scope declares itself a monorepo root, the ':' shorthand has nothing to be relative to, so mise bails. Bare task names pass through untouched in this situation — only colon patterns error.

Source

Thrown at src/task/task_load_context.rs:210

    if !is_colon_pattern && task.contains('/') && task.contains(':') {
        bail!(
            "relative path syntax '{}' is not supported, use '//{}' or ':task' for current directory",
            task,
            task
        );
    }

    // Get the monorepo root config file.
    let monorepo_root = config
        .config_files
        .values()
        .find(|cf| cf.monorepo_root() == Some(true))
        .and_then(|cf| cf.project_root());

    // If not in monorepo context, only expand if it's a colon pattern (error), otherwise return as-is
    if monorepo_root.is_none() {
        if is_colon_pattern {
            bail!("Cannot use :task syntax without a monorepo root");
        }
        return Ok(task.to_string());
    }

    // We're in a monorepo context
    let monorepo_root = monorepo_root.unwrap();

    // Task names are keyed to project roots: the directories of configs in
    // scope plus declared [monorepo].config_roots, which may hold only file
    // tasks and no config. Scope to the nearest such root above cwd, not cwd
    // itself; the monorepo root bounds the walk and counts as a root.
    if let Some(cwd) = &*crate::dirs::CWD {
        let scope_dir: &Path = if cwd.starts_with(&monorepo_root) {
            let roots: Vec<PathBuf> = config
                .config_files
                .values()
                .filter_map(|cf| cf.project_root())
                .chain(config.monorepo_config_root_dirs(None).unwrap_or_default())

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. Mark the repo root config as monorepo root (add the [monorepo] settings / monorepo marker in the root mise.toml).
  2. Use the plain task name instead: `mise build`.
  3. Use the absolute syntax `mise //path/to/pkg:build` only after a monorepo root is declared — otherwise just run the task by bare name.
  4. Run `mise trust` if the root config exists but is untrusted so its monorepo flag is not loaded.

Example fix

# before
# mise.toml (repo root) lacks monorepo marker
$ mise :build
error: Cannot use :task syntax without a monorepo root

# after
# mise.toml
[monorepo]
config_roots = ["packages/*"]
$ mise :build
Defensive patterns

Strategy: validation

Validate before calling

# check a monorepo marker exists before using :task
mise config ls 2>/dev/null | grep -q mise.toml || { echo 'no mise config in scope' >&2; exit 1; }
mise :build

Prevention

When it happens

Trigger: Running `mise :build` in a repo where no mise.toml sets the monorepo marker (e.g. no `[monorepo]` section / monorepo = true in the root config), or where the root config is untrusted so it is not in config_files at all.

Common situations: Copy-pasting monorepo-style invocations into a single-package repo; the monorepo root config was renamed or removed; using a non-mise monorepo (pnpm-workspace, cargo workspace) without adding mise's marker.

Related errors


AI-assisted analysis of jdx/mise@9dcfcaa0dc (2026-08-17). Data as JSON: /api/errors/930398c210feb72c. Report an issue: GitHub.