jdx/mise · error

{msg}

Error message

{msg}

What it means

On Windows, `ensure_temp_dir_can_replace_binary` validates that the TEMP directory path is short enough that the update's rename/replace operations will not exceed the Windows MAX_PATH limit, computing the longest expected helper path. If the projected path length exceeds MAX_PATH, the update aborts with a detailed message showing the TEMP path, its length, the computed helper path length, and the maximum.

Source

Thrown at src/cli/self_update.rs:467

        let msg = formatdoc! {r#"
            TEMP is too long to replace mise.exe safely ({len} UTF-16 code units)

              TEMP = {tmp}

            Updating moves the running mise.exe aside and then launches a helper from TEMP to
            put the new one in place. That helper's path would be {helper} UTF-16 code units,
            and Windows cannot launch an executable whose path reaches {max}. The move happens
            first, so going ahead would leave no mise installed at all.

            Point TEMP and TMP at a shorter directory and run mise self-update again:

              $env:TEMP = 'C:\Temp'; $env:TMP = 'C:\Temp'"#,
            len = tmp.as_os_str().encode_wide().count(),
            tmp = tmp.display(),
            helper = helper_path_len(&tmp, stem.as_deref()),
            max = MAX_PATH,
        };
        bail!("{msg}");
    }

    fn do_update(&self) -> Result<VersionStatus> {
        // Use block_in_place to allow self_update's blocking HTTP calls
        // to work within mise's async runtime
        tokio::task::block_in_place(|| self.do_update_blocking())
    }

    fn do_update_blocking(&self) -> Result<VersionStatus> {
        let settings = Settings::try_get();
        let source = settings
            .as_ref()
            .map(|settings| SelfUpdateSource::from_settings(settings))
            .unwrap_or_default();
        source.validate()?;
        let (repo_owner, repo_name) = source.repository_parts()?;
        let mut update = Update::configure();
        update.reqwest_client(Self::http_client()?);

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Set TEMP/TMP to a short directory: in PowerShell `$env:TEMP='C:\Temp'; $env:TMP='C:\Temp'` before running `mise self-update`
  2. Permanently shorten the TEMP location via System Properties > Environment Variables
  3. Enable Windows long-path support (LongPathsEnabled registry key) — helps some cases but the check still enforces its own limit
  4. Move the user profile or mise install to a shallower path

Example fix

// before (PowerShell)
$env:TEMP = 'C:\Users\averyveryverylongprofilename\AppData\Local\Temp'; mise self-update  # bail
// after
$env:TEMP = 'C:\Temp'; $env:TMP = 'C:\Temp'
mise self-update
Defensive patterns

Strategy: validation

Validate before calling

$tmp = $env:TEMP
$len = ($tmp + '\' + 'mise-self-update-helper' + '.exe').Length
if ($len -ge 260) { Write-Error "TEMP path too long for self-update ($len >= 260); set TEMP to a short dir like C:\Temp" }

Prevention

When it happens

Trigger: Running `mise self-update` on Windows where the TEMP (or TMP) environment variable points to a deeply nested directory such that temp-path + helper-file name exceeds MAX_PATH (260 chars). Common with deep user profiles or relocated TEMP dirs.

Common situations: Corporate machines with roaming profiles under very long user directory names; users who set TEMP to a long custom path; CI runners with long workspace paths.

Related errors


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