{"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":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/generate/task_stubs.rs","lineNumber":207,"sourceCode":"}\n\nfn validate_stub_paths(dir: &Path, stubs: &[TaskStub<'_>]) -> 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)?;\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":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/cli/generate/task_stubs.rs#L189-L225","documentation":"While migrating a task to the nested layout, the legacy path exists but is neither a regular file nor a directory (fifo, socket, device node). The migration only knows how to replace its own file or descend through a directory, so it refuses rather than destroy an unknown object.","triggerScenarios":"A named pipe, socket, or device sits at bin/<legacy path> when `mise generate task-stubs` runs with a parent/nested task pair present.","commonSituations":"Dev leftovers in bin/ (mkfifo experiments), odd container image contents, bind mounts exposing special files into the stub directory.","solutions":["Remove the special file: `rm bin/<legacy path>`","Regenerate into a clean directory (`mise generate task-stubs --dir bin2`) and swap it in","If something must keep that name, rename the task"],"exampleFix":"# before\n$ ls -l bin/build   # shows pipe/socket type\n$ mise generate task-stubs\n# error: bin/build is not a directory\n\n# after\n$ rm bin/build\n$ mise generate task-stubs","handlingStrategy":"type-guard","validationCode":"#!/bin/bash\n# only regular files and directories may exist under the stub dir\nfind bin -mindepth 1 ! -type d ! -type f -print -quit | grep -q . \\\n  && { echo 'special file under bin/' >&2; exit 1; }\nmise generate task-stubs","typeGuard":"is_plain_fs_object() {\n  # 0 when path is absent, a regular file, or a directory\n  [ -e \"$1\" ] || return 0\n  [ -f \"$1\" ] || [ -d \"$1\" ]\n}","tryCatchPattern":null,"preventionTips":["Keep bin/ free of fifos/sockets and other special objects","Generate stubs into a dedicated, tool-owned directory rather than a shared bin/"],"tags":["mise","task-stubs","file-type","migration","generate"],"backgroundTag":"unsupported-file-type","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}