jdx/mise · error

global configuration directory must not be a symlink

Error message

global configuration directory must not be a symlink

What it means

install_at refuses to install into a destination that is a symbolic link. The global configuration directory (e.g. ~/.config/mise) is managed in place; replacing or writing through a symlink risks corrupting or escaping the intended install target, so it is rejected up front.

Solutions

  1. Remove the symlink and create a real directory at the destination (`rm <dest> && mkdir <dest>`), migrating contents first.
  2. Reconfigure your dotfile manager to manage files *inside* the directory rather than the directory itself.
  3. Choose a different non-symlink destination path if supported by your tooling.

Example fix

// before
$ ls -la ~/.config/mise
mise -> /mnt/dotfiles/mise   # symlink
// after
$ rm ~/.config/mise
$ mkdir ~/.config/mise
$ cp -a /mnt/dotfiles/mise/. ~/.config/mise/
Defensive patterns

Strategy: validation

Validate before calling

const st = fs.lstatSync(destination);
if (st.isSymbolicLink()) throw new Error("destination must be a real directory, not a symlink");

Type guard

function isRealDir(p: string): boolean { try { return fs.lstatSync(p).isDirectory(); } catch { return false; } }

Prevention

When it happens

Trigger: Calling install / install_at / install_source / preview_source where `destination.is_symlink()` is true — e.g. the destination path itself was replaced by a symlink by a dotfile manager (stow, chezmoi, dotbot).

Common situations: Dotfile managers symlinking ~/.config/mise to a synced folder; users manually linking config dirs across filesystems; restoring from backups that turned directories into links.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at src/system/remote_repository.rs:194

        &global_directory(),
    )
}

fn install_at(
    bundle: &Path,
    origin: &str,
    revision: &str,
    update: bool,
    yes: bool,
    dry_run: bool,
    destination: &Path,
) -> Result<PathBuf> {
    validate_origin(origin)?;
    if !matches!(revision.len(), 40 | 64) || !revision.bytes().all(|b| b.is_ascii_hexdigit()) {
        bail!("invalid pinned revision");
    }
    if destination.is_symlink() {
        bail!("global configuration directory must not be a symlink");
    }
    let parent = destination
        .parent()
        .ok_or_else(|| eyre::eyre!("missing parent directory"))?;
    if !dry_run {
        std::fs::create_dir_all(parent)?;
    }
    let _lock = crate::lock_file::LockFile::new(destination).lock()?;
    // the checkout is renamed into place, so it is staged next to the
    // destination; a dry run never renames and leaves the parent alone
    let temporary = if dry_run {
        tempfile::tempdir()?
    } else {
        tempfile::tempdir_in(parent)?
    };
    let checkout = temporary.path().join("checkout");
    let shown = crate::file::display_path(destination);
    let mut command = Command::new("git");

View on GitHub (pinned to 533346cc37)