{"record":{"id":"dcef02ccac687971","repo":"jdx/mise","slug":"temp-is-too-long-to-replace-mise-exe-safely-len","errorCode":null,"errorMessage":"TEMP is too long to replace mise.exe safely ({len} UTF-16 code units)\n\n  TEMP = {tmp}\n\nUpdating moves the running mise.exe aside and then launches a helper from TEMP to\nput the new one in place. That helper's path would be {helper} UTF-16 code units,\nand Windows cannot launch an executable whose path reaches {max}. The move happens\nfirst, so going ahead would leave no mise installed at all.\n\nPoint TEMP and TMP at a shorter directory and run mise self-update again:\n\n  $env:TEMP = 'C:\\Temp'; $env:TMP = 'C:\\Temp'","messagePattern":"TEMP is too long to replace mise\\.exe safely \\(\\{len\\} UTF-16 code units\\)\n\n  TEMP = \\{tmp\\}\n\nUpdating moves the running mise\\.exe aside and then launches a helper from TEMP to\nput the new one in place\\. That helper's path would be \\{helper\\} UTF-16 code units,\nand Windows cannot launch an executable whose path reaches \\{max\\}\\. The move happens\nfirst, so going ahead would leave no mise installed at all\\.\n\nPoint TEMP and TMP at a shorter directory and run mise self-update again:\n\n  \\$env:TEMP = 'C:\\\\Temp'; \\$env:TMP = 'C:\\\\Temp'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/self_update.rs","lineNumber":495,"sourceCode":"        let msg = formatdoc! {r#\"\n            TEMP is too long to replace mise.exe safely ({len} UTF-16 code units)\n\n              TEMP = {tmp}\n\n            Updating moves the running mise.exe aside and then launches a helper from TEMP to\n            put the new one in place. That helper's path would be {helper} UTF-16 code units,\n            and Windows cannot launch an executable whose path reaches {max}. The move happens\n            first, so going ahead would leave no mise installed at all.\n\n            Point TEMP and TMP at a shorter directory and run mise self-update again:\n\n              $env:TEMP = 'C:\\Temp'; $env:TMP = 'C:\\Temp'\"#,\n            len = tmp.as_os_str().encode_wide().count(),\n            tmp = tmp.display(),\n            helper = helper_path_len(&tmp, stem.as_deref()),\n            max = MAX_PATH,\n        };\n        bail!(\"{msg}\");\n    }\n\n    fn do_update(&self) -> Result<VersionStatus> {\n        // Use block_in_place to allow self_update's blocking HTTP calls\n        // to work within mise's async runtime\n        tokio::task::block_in_place(|| self.do_update_blocking())\n    }\n\n    fn do_update_blocking(&self) -> Result<VersionStatus> {\n        let settings = Settings::try_get();\n        let source = settings\n            .as_ref()\n            .map(|settings| SelfUpdateSource::from_settings(settings))\n            .unwrap_or_default();\n        source.validate()?;\n        let (repo_owner, repo_name) = source.repository_parts()?;\n        let mut update = Update::configure();\n        update.reqwest_client(Self::http_client()?);","sourceCodeStart":477,"sourceCodeEnd":513,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/self_update.rs#L477-L513","documentation":"On Windows, self-update moves the running mise.exe aside and launches a helper executable from the TEMP directory to complete the replacement. If the TEMP path is so long that the helper's full path would reach the MAX_PATH limit (32767 UTF-16 code units), Windows cannot launch it — and since the running binary was already moved, proceeding would leave no mise installed at all. mise checks this upfront and bails.","triggerScenarios":"Running `mise self-update` on Windows where the TEMP/TMP environment variable points to a deeply nested directory whose derived helper path length meets or exceeds MAX_PATH.","commonSituations":"Corporate machines with long user profile paths (C:\\Users\\very.long.username\\AppData\\Local\\Temp); CI runners with deep temporary directories.","solutions":["Set TEMP and TMP to a short directory: $env:TEMP = 'C:\\Temp'; $env:TMP = 'C:\\Temp', then rerun mise self-update","Create C:\\Temp if it does not exist","Alternatively update via the install script instead of self-update"],"exampleFix":"// before\n# TEMP=C:\\Users\\long.username\\AppData\\Local\\Temp\nmise self-update  # TEMP is too long to replace mise.exe safely\n// after\n$env:TEMP = 'C:\\Temp'; $env:TMP = 'C:\\Temp'\nmise self-update","handlingStrategy":"validation","validationCode":"if ((\"$(${#TEMP})\" + 80 >= 32767)); then export TEMP='C:\\Temp' TMP='C:\\Temp'; fi; mise self-update","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep TEMP/TMP pointing at short paths like C:\\Temp on build/update machines","Check path length before long-path-sensitive operations"],"tags":["windows","self-update","path-length"],"backgroundTag":"value-out-of-range","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}