jdx/mise · error

multiple tasks map to task stub path {}

Error message

multiple tasks map to task stub path {}

What it means

`mise generate task-stubs` maps each task name to a path under --dir, moving a parent task that collides with a nested task to `<parent>/_default`. After that resolution two distinct tasks still produced the same file path; writing both would silently overwrite one stub with the other, so mise stops with the colliding path.

Source

Thrown at src/cli/generate/task_stubs.rs:182

        .collect::<Vec<_>>();
    let paths = base_paths
        .iter()
        .enumerate()
        .map(|(index, path)| {
            if base_paths.iter().enumerate().any(|(other_index, other)| {
                index != other_index && other != path && other.starts_with(path)
            }) {
                path.join("_default")
            } else {
                path.clone()
            }
        })
        .collect::<Vec<_>>();

    let mut seen = HashSet::new();
    for path in &paths {
        if !seen.insert(path) {
            bail!(
                "multiple tasks map to task stub path {}",
                display_path(path)
            );
        }
    }
    Ok(paths)
}

fn validate_stub_paths(dir: &Path, stubs: &[TaskStub<'_>]) -> Result<Vec<StubMigration>> {
    let mut migrations = HashSet::new();
    for stub in stubs.iter().filter(|stub| stub.legacy_path != stub.path) {
        match fs::symlink_metadata(&stub.legacy_path) {
            Ok(metadata) if metadata.file_type().is_file() => {
                let existing = file::read_to_string(&stub.legacy_path)?;
                if existing != stub.output && existing != stub.legacy_output {
                    bail!(
                        "cannot create nested task stubs because {} is not the generated stub for task {}",
                        display_path(&stub.legacy_path),

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. List tasks with `mise tasks ls` and rename whichever task collides (change its name in mise.toml [tasks] or the tasks/ file name) so the paths differ
  2. Remove the duplicate/leftover definition — check both [tasks] tables and files under tasks/
  3. Point --dir at an empty directory and regenerate to confirm the collision is in task names, not stale stub files

Example fix

# before: tasks `foo`, `foo:bar`, and `foo:_default` (tasks/foo/_default.toml)
$ mise generate task-stubs
# error: multiple tasks map to task stub path bin/foo/_default

# after: delete tasks/foo/_default.toml (or rename its task)
$ git rm tasks/foo/_default.toml
$ mise generate task-stubs
Defensive patterns

Strategy: validation

Validate before calling

#!/bin/bash
# flag tasks whose names fold to the same stub path (colon -> directory)
mise tasks ls --json 2>/dev/null | jq -r '.[]!.name' \
  | tr ':' '/' | sort | uniq -d | while read -r dup; do
    echo "colliding stub path: bin/$dup" >&2; exit 1
done
mise generate task-stubs

Prevention

When it happens

Trigger: A task set where distinct names fold onto one path: e.g. a task literally named `foo:_default` (file tasks/foo/_default.toml) alongside `foo` plus a nested `foo:bar` — the parent rule sends `foo` to foo/_default too; or names that differ only in separators name_to_path folds together.

Common situations: Adding nested tasks after a flat task list already exists; a tasks/ file whose directory-derived name collides with an explicitly named task; tasks defined in both mise.toml [tasks] and task files with matching names.

Related errors


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