jdx/mise · error

Unknown shim mode

Error message

Unknown shim mode

What it means

add_shim() on Windows dispatches on the configured shim mode (MISE_WINDOWS_SHIM_MODE: 'symlink' vs 'file'); any unrecognized value falls through to an unconditional panic('Unknown shim mode'). Because the mode string is not validated at parse time, an invalid setting only explodes when mise tries to create shims.

Solutions

  1. Set MISE_WINDOWS_SHIM_MODE to a valid value ('symlink' or 'file') or unset it to use the default
  2. Check `mise settings` / global config for a misspelled windows shim mode entry and correct it
  3. Upgrade mise — if a documented mode value was renamed, current code may accept the new name only

Example fix

// before
$env:MISE_WINDOWS_SHIM_MODE = 'symlinks'
// after
$env:MISE_WINDOWS_SHIM_MODE = 'symlink'
Defensive patterns

Strategy: validation

Validate before calling

$allowed = 'symlink','file'
if ($env:MISE_WINDOWS_SHIM_MODE -and $allowed -notcontains $env:MISE_WINDOWS_SHIM_MODE) { throw "MISE_WINDOWS_SHIM_MODE must be one of: $($allowed -join ', ')" }

Prevention

When it happens

Trigger: Calling add_shim() (via write_bootstrap_shims, stage_shim_farm, or sync_command_wrapper_shims) with a shim mode string other than the accepted 'symlink'/'file' variants — typically a typo'd or stale MISE_WINDOWS_SHIM_MODE environment variable or windows shim mode config setting.

Common situations: User sets MISE_WINDOWS_SHIM_MODE to a typo like 'symlinks' or leaves a value from an older mise version whose mode names have since changed; copy-pasting settings between machines; CI environment exporting a wrong mode.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/355c8490a7db3838. Report an issue: GitHub.

Appendix: source

Thrown at src/shims.rs:1454

            })
        }
        "hardlink" => fs::hard_link(mise_bin, symlink_path).wrap_err_with(|| {
            eyre!(
                "Failed to create hardlink from {} to {}",
                display_path(mise_bin),
                display_path(symlink_path)
            )
        }),
        "symlink" => {
            std::os::windows::fs::symlink_file(mise_bin, symlink_path).wrap_err_with(|| {
                eyre!(
                    "Failed to create symlink from {} to {}",
                    display_path(mise_bin),
                    display_path(symlink_path)
                )
            })
        }
        _ => panic!("Unknown shim mode"),
    }
}

#[cfg(unix)]
fn add_shim(mise_bin: &Path, symlink_path: &Path, _shim: &str) -> Result<()> {
    file::make_symlink(mise_bin, symlink_path).wrap_err_with(|| {
        eyre!(
            "Failed to create symlink from {} to {}",
            display_path(mise_bin),
            display_path(symlink_path)
        )
    })?;
    Ok(())
}

pub(crate) struct ShimDiffs {
    pub missing: BTreeSet<String>,
    pub extra: BTreeSet<String>,

View on GitHub (pinned to afd2eddd3a)