jdx/mise · error

multiple tasks map to task stub path

Error message

multiple tasks map to task stub path {}

What it means

When generating task stubs, each task maps to a stub file path derived from its name. This error means two distinct tasks resolved to the same output path, so writing stubs would make one file silently overwrite the other; mise detects the collision and aborts instead.

Solutions

  1. Rename one of the colliding tasks so each maps to a unique stub path
  2. Move one task file to a different directory so the derived stub paths differ
  3. List the generated stub paths (`mise generate task-stubs --dry-run` if available) to identify which tasks collide

Example fix

// before
tasks/build.sh        # task "build"
tasks/build/main.sh   # also resolves to build stub
// after
tasks/build.sh        # task "build"
tasks/build-image/main.sh  # renamed task
Defensive patterns

Strategy: validation

Validate before calling

const names = taskNames.map(t => stubPathFor(t));
const dupes = names.filter((n, i) => names.indexOf(n) !== i);
if (dupes.length) throw new Error(`tasks collide on stub path: ${dupes.join(', ')}`);

Try / catch

try {
  execSync('mise generate task-stubs');
} catch (e) {
  if (String(e).includes('multiple tasks map to task stub path')) {
    console.error('Rename one of the colliding tasks; see stub path in message');
  }
}

Prevention

When it happens

Trigger: Running `mise generate task-stubs` in a project where two task definitions (e.g. tasks in different directories or a nested plus top-level task) normalize to the same stub filename, such as `foo/bar` vs a task literally named `foo/bar`.

Common situations: Projects with tasks in nested directories whose names collide after path normalization; a new task file added that shadows an existing task name; case-only collisions on case-insensitive filesystems.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


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

Appendix: source

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

        .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<'_>],
    launchers: &Launchers,
) -> 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)?;

View on GitHub (pinned to 533346cc37)