{"record":{"id":"bfa7f2a94412de90","repo":"jdx/mise","slug":"cannot-write-task-stub-because-is-not-a-regular","errorCode":null,"errorMessage":"cannot write task stub because {} is not a regular file","messagePattern":"cannot write task stub because (.+?) is not a regular file","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/generate/task_stubs.rs","lineNumber":547,"sourceCode":"            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            ),\n            Ok(metadata) if metadata.file_type().is_file() => {\n                let existing = file::read_to_string(&stub.path)?;\n                let legacy_leaf = stub.legacy_path == stub.path && existing == stub.legacy_output;\n                if existing != stub.output && !legacy_leaf {\n                    bail!(\n                        \"cannot write task stub because {} is not a generated task stub\",\n                        display_path(&stub.path)\n                    );\n                }\n            }\n            Ok(_) => bail!(\n                \"cannot write task stub because {} is not a regular file\",\n                display_path(&stub.path)\n            ),\n            Err(err) if matches!(err.kind(), ErrorKind::NotFound | ErrorKind::NotADirectory) => {}\n            Err(err) => return Err(err.into()),\n        }\n        validate_launcher_path(stub, launchers)?;\n        for parent in stub.path.ancestors().skip(1) {\n            match fs::symlink_metadata(parent) {\n                Ok(metadata)\n                    if metadata.file_type().is_dir()\n                        || migrations.contains(&StubMigration::File(parent.to_path_buf())) => {}\n                Ok(_) => bail!(\n                    \"cannot create task stub directory because {} is not a directory\",\n                    display_path(parent)\n                ),\n                Err(err)\n                    if matches!(err.kind(), ErrorKind::NotFound | ErrorKind::NotADirectory) => {}","sourceCodeStart":529,"sourceCodeEnd":565,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/generate/task_stubs.rs#L529-L565","documentation":"mise checks the type of any existing entry at a task stub path before writing. This error means the path exists as something that is not a regular file or directory (e.g. a FIFO, socket, or device), so a stub cannot be written there and mise aborts.","triggerScenarios":"Running `mise generate task-stubs` where a stub target path holds a special filesystem object instead of a regular file.","commonSituations":"Corrupted checkouts, leftover named pipes from build tooling, or unusual filesystems at the tasks directory path.","solutions":["Inspect the path with `ls -la` and remove the non-regular entry","Rerun `mise generate task-stubs` after cleanup","If the path is on a filesystem that mangles file types, relocate the tasks directory"],"exampleFix":"// before\n$ ls -la .mise/tasks/build\nsrwxr-xr-x build  # socket\n// after\n$ rm .mise/tasks/build && mise generate task-stubs","handlingStrategy":"validation","validationCode":"const st = fs.lstatSync(stubPath, { throwIfNoEntry: false });\nif (st && !st.isFile() && !st.isDirectory()) {\n  throw new Error(`${stubPath} is not a regular file; remove it before generating stubs`);\n}","typeGuard":"const isRegularFileOrAbsent = (p: string): boolean => {\n  const st = fs.lstatSync(p, { throwIfNoEntry: false });\n  return !st || st.isFile();\n};","tryCatchPattern":null,"preventionTips":["Avoid running tools that create pipes/sockets inside the tasks directory","Verify filesystem health if special files appear unexpectedly","Keep generated stub trees clean of non-source artifacts"],"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"}