{"record":{"id":"5e40869746c185b5","repo":"jdx/mise","slug":"cannot-create-nested-task-stubs-because-is-not-5e4086","errorCode":null,"errorMessage":"cannot create nested task stubs because {} is not a directory","messagePattern":"cannot create nested task stubs because (.+?) is not a directory","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/generate/task_stubs.rs","lineNumber":518,"sourceCode":"    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)?;\n                if existing != stub.output && existing != stub.legacy_output {\n                    bail!(\n                        \"cannot create nested task stubs because {} is not the generated stub for task {}\",\n                        display_path(&stub.legacy_path),\n                        stub.task.display_name\n                    );\n                }\n                migrations.insert(StubMigration::File(stub.legacy_path.clone()));\n            }\n            Ok(metadata) if metadata.file_type().is_dir() => {}\n            Ok(_) => bail!(\n                \"cannot create nested task stubs because {} is not a directory\",\n                display_path(&stub.legacy_path)\n            ),\n            Err(err) if matches!(err.kind(), ErrorKind::NotFound | ErrorKind::NotADirectory) => {}\n            Err(err) => return Err(err.into()),\n        }\n    }\n\n    for stub in stubs {\n        match fs::symlink_metadata(&stub.path) {\n            Ok(metadata) if metadata.file_type().is_dir() => {\n                validate_generated_stub_directory(&stub.path, &stub.output, stub.task, launchers)?;\n                migrations.insert(StubMigration::Directory(stub.path.clone()));\n            }\n            Ok(metadata) if metadata.file_type().is_symlink() => bail!(\n                \"cannot write task stub because {} is a symbolic link\",\n                display_path(&stub.path)\n            ),","sourceCodeStart":500,"sourceCodeEnd":536,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/generate/task_stubs.rs#L500-L536","documentation":"During nested task stub generation, mise checks every ancestor path of each stub. If a legacy stub path exists but is neither a directory nor a migratable file (e.g. a FIFO, device, or other special file), mise cannot create the required directory and aborts with this error.","triggerScenarios":"Running `mise generate task-stubs` where a path that must become a stub directory (a legacy stub location) exists as a non-regular, non-directory filesystem entry such as a named pipe or socket.","commonSituations":"Rare filesystem oddities: leftover special files at task paths, symlink targets resolving to special files, or corrupted checkouts on unusual filesystems.","solutions":["Inspect the path with `ls -la` and remove or replace the special file with a directory","If it is a stale artifact, delete it and rerun `mise generate task-stubs`","Check for symlinks pointing at unexpected targets and fix them"],"exampleFix":"// before\n$ ls -la .mise/tasks/build\nprw-r--r-- build  # FIFO\n// after\n$ rm .mise/tasks/build && mise generate task-stubs","handlingStrategy":"validation","validationCode":"const st = fs.lstatSync(legacyPath);\nif (st.exists && !st.isDirectory() && !st.isFile()) {\n  throw new Error(`${legacyPath} is a special file; remove it before generating nested stubs`);\n}","typeGuard":"const isRegularOrDir = (st: fs.Stats) => st.isFile() || st.isDirectory();","tryCatchPattern":null,"preventionTips":["Audit task paths for special files (FIFOs, sockets) after odd filesystem operations","Keep the tasks directory on a normal filesystem","Clean stale build artifacts out of the tasks directory"],"tags":["cli","task-stubs","filesystem"],"backgroundTag":"path-is-not-a-directory","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"}