jdx/mise · error

cannot write task stub because {} is not a regular file

Error message

cannot write task stub because {} is not a regular file

What it means

The stub path exists but is not a regular file (and not one of the directory/symlink cases handled elsewhere) — typically a fifo or socket. mise cannot write a stub onto a special file, so it aborts with the offending path.

Source

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

            Ok(metadata) if metadata.file_type().is_dir() => {
                validate_generated_stub_directory(&stub.path, &stub.output, stub.task)?;
                migrations.insert(StubMigration::Directory(stub.path.clone()));
            }
            Ok(metadata) if metadata.file_type().is_symlink() => bail!(
                "cannot write task stub because {} is a symbolic link",
                display_path(&stub.path)
            ),
            Ok(metadata) if metadata.file_type().is_file() => {
                let existing = file::read_to_string(&stub.path)?;
                let legacy_leaf = stub.legacy_path == stub.path && existing == stub.legacy_output;
                if existing != stub.output && !legacy_leaf {
                    bail!(
                        "cannot write task stub because {} is not a generated task stub",
                        display_path(&stub.path)
                    );
                }
            }
            Ok(_) => bail!(
                "cannot write task stub because {} is not a regular file",
                display_path(&stub.path)
            ),
            Err(err) if matches!(err.kind(), ErrorKind::NotFound | ErrorKind::NotADirectory) => {}
            Err(err) => return Err(err.into()),
        }
        validate_launcher_path(stub)?;
        for parent in stub.path.ancestors().skip(1) {
            match fs::symlink_metadata(parent) {
                Ok(metadata)
                    if metadata.file_type().is_dir()
                        || migrations.contains(&StubMigration::File(parent.to_path_buf())) => {}
                Ok(_) => bail!(
                    "cannot create task stub directory because {} is not a directory",
                    display_path(parent)
                ),
                Err(err)
                    if matches!(err.kind(), ErrorKind::NotFound | ErrorKind::NotADirectory) => {}

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. Delete the special file: `rm bin/<task>`
  2. Regenerate with a different --dir
  3. Rename the task so its stub path avoids the object

Example fix

# before
$ rm -f bin/lint && mkfifo bin/lint   # accidental leftover
$ mise generate task-stubs
# error: bin/lint is not a regular file

# after
$ rm bin/lint
$ mise generate task-stubs
Defensive patterns

Strategy: type-guard

Validate before calling

#!/bin/bash
find bin -mindepth 1 ! -type d ! -type f ! -type l -print -quit | grep -q . \
  && { echo 'special file under bin/' >&2; exit 1; }
mise generate task-stubs

Type guard

is_regular_or_absent() {
  [ ! -e "$1" ] || { [ -f "$1" ] && [ ! -L "$1" ]; }
}

Prevention

When it happens

Trigger: `mise generate task-stubs` with a special file at bin/<task> or bin/<parent>/_default (mkfifo leftover, socket, device node).

Common situations: Artifacts dropped into bin/ by other tooling; broken mounts; experiments left behind.

Related errors


AI-assisted analysis of jdx/mise@9dcfcaa0dc (2026-08-17). Data as JSON: /api/errors/bfa7f2a94412de90. Report an issue: GitHub.