{"record":{"id":"c6b1fa75ed61df4e","repo":"jdx/mise","slug":"multiple-tasks-map-to-task-stub-path","errorCode":null,"errorMessage":"multiple tasks map to task stub path {}","messagePattern":"multiple tasks map to task stub path (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/generate/task_stubs.rs","lineNumber":489,"sourceCode":"        .collect::<Vec<_>>();\n    let paths = base_paths\n        .iter()\n        .enumerate()\n        .map(|(index, path)| {\n            if base_paths.iter().enumerate().any(|(other_index, other)| {\n                index != other_index && other != path && other.starts_with(path)\n            }) {\n                path.join(\"_default\")\n            } else {\n                path.clone()\n            }\n        })\n        .collect::<Vec<_>>();\n\n    let mut seen = HashSet::new();\n    for path in &paths {\n        if !seen.insert(path) {\n            bail!(\n                \"multiple tasks map to task stub path {}\",\n                display_path(path)\n            );\n        }\n    }\n    Ok(paths)\n}\n\nfn validate_stub_paths(\n    dir: &Path,\n    stubs: &[TaskStub<'_>],\n    launchers: &Launchers,\n) -> Result<Vec<StubMigration>> {\n    let mut migrations = HashSet::new();\n    for stub in stubs.iter().filter(|stub| stub.legacy_path != stub.path) {\n        match fs::symlink_metadata(&stub.legacy_path) {\n            Ok(metadata) if metadata.file_type().is_file() => {\n                let existing = file::read_to_string(&stub.legacy_path)?;","sourceCodeStart":471,"sourceCodeEnd":507,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/generate/task_stubs.rs#L471-L507","documentation":"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.","triggerScenarios":"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`.","commonSituations":"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.","solutions":["Rename one of the colliding tasks so each maps to a unique stub path","Move one task file to a different directory so the derived stub paths differ","List the generated stub paths (`mise generate task-stubs --dry-run` if available) to identify which tasks collide"],"exampleFix":"// before\ntasks/build.sh        # task \"build\"\ntasks/build/main.sh   # also resolves to build stub\n// after\ntasks/build.sh        # task \"build\"\ntasks/build-image/main.sh  # renamed task","handlingStrategy":"validation","validationCode":"const names = taskNames.map(t => stubPathFor(t));\nconst dupes = names.filter((n, i) => names.indexOf(n) !== i);\nif (dupes.length) throw new Error(`tasks collide on stub path: ${dupes.join(', ')}`);","typeGuard":null,"tryCatchPattern":"try {\n  execSync('mise generate task-stubs');\n} catch (e) {\n  if (String(e).includes('multiple tasks map to task stub path')) {\n    console.error('Rename one of the colliding tasks; see stub path in message');\n  }\n}","preventionTips":["Keep task names unique after path normalization (avoid directory/name duplicates)","Avoid case-only task name differences on case-insensitive filesystems","Review new task files for shadowing existing task names","Dry-run or list resolved stub paths before committing new task layouts"],"tags":["cli","task-stubs","name-collision"],"backgroundTag":"invalid-identifier-format","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}