jdx/mise · error

mode symlink-each requires the source to be a directory

Error message

mode symlink-each requires the source to be a directory

What it means

The file-management (dotfiles) subsystem's `symlink-each` mode links each entry inside a source directory individually into the target. This error is thrown during unapply planning when `SymlinkEach` is reached even though the request's source is not a directory (the directory case is handled earlier; reaching this arm means the source was missing or not a directory). The library refuses to guess what set of files the mode would have managed, so it aborts.

Solutions

  1. Restore the source directory (git checkout / correct path) so symlink-each has a directory to enumerate
  2. Fix the `source` path in the file entry config to point at an existing directory
  3. If only a single file should be linked, change the entry mode to `symlink`
  4. Remove or comment out the stale file entry if it is no longer needed

Example fix

// before (mise.toml)
[[files]]
mode = "symlink-each"
source = "~/.dotfiles/nvim"
target = "~/.config/nvim"

// after — path corrected to the real directory
[[files]]
mode = "symlink-each"
source = "~/dotfiles/config/nvim"
target = "~/.config/nvim"
Defensive patterns

Strategy: validation

Validate before calling

if !source.is_dir() {
    return Err(format!("symlink-each needs a directory source; '{}' is missing or not a directory", source.display()));
}

Prevention

When it happens

Trigger: Calling the files unapply/plan flow with `FileMode::SymlinkEach` while `req.source` is not an existing directory — e.g. the source directory was deleted/renamed/moved before unapply, or the mode was set on a single-file source.

Common situations: A user renamed their dotfiles repo directory, checked out a branch where the directory no longer exists, or typo'd the `source` path in mise.toml while using `symlink-each` mode, then ran `mise files unapply` or `mise files status`.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/40369e65825d9dcd. Report an issue: GitHub.

Appendix: source

Thrown at src/system/files.rs:2819

                req.target.display_user()
            );
            return Ok(None);
        }
        FileMode::Content => {
            if !req.target.exists() && !req.target.is_symlink() {
                return Ok(None);
            }
            if opts.force {
                paths.insert(req.target.clone(), ());
            } else {
                plan_inline_file(req, &mut paths)?;
            }
        }
        FileMode::Symlink => {
            plan_single_file(req, opts, &mut paths)?;
        }
        FileMode::SymlinkEach => {
            bail!("mode symlink-each requires the source to be a directory");
        }
        FileMode::Template => {
            if !req.target.exists() && !req.target.is_symlink() {
                return Ok(None);
            }
            if opts.force {
                paths.insert(req.target.clone(), ());
            } else if opts.dry_run {
                // Rendering may execute commands. Keep dry-run inert, matching
                // apply/status policy, and describe the removal as conditional.
                paths.insert(req.target.clone(), ());
                conditional = true;
            } else {
                if !req.source.exists() {
                    bail!("source is missing; use --force to remove the target");
                }
                // Rendering may execute user-authored commands. Defer it until
                // after the complete unapply plan has been confirmed.

View on GitHub (pinned to 533346cc37)