{"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":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/self_update.rs","lineNumber":270,"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<Status> {\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<Status> {\n        let mut update = Update::configure();\n        if let Some((token, _)) = crate::github::resolve_token(\"github.com\") {\n            update.auth_token(&token);\n        }\n        #[cfg(windows)]\n        let bin_path_in_archive = \"mise/bin/mise.exe\";\n        #[cfg(not(windows))]\n        let bin_path_in_archive = \"mise/bin/mise\";\n        update","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/cli/self_update.rs#L252-L288","documentation":"Windows self-update moves the running mise.exe aside and then launches a helper from %TEMP% to put the new binary in place. mise pre-computes the helper's path length (UTF-16 code units, stem-aware) and refuses if it would reach MAX_PATH (260) — Windows cannot launch an executable with that path, and because the move happens first, proceeding would leave NO mise installed. The message tells you to point TEMP/TMP at a short directory.","triggerScenarios":"`mise self-update` on Windows where %TEMP% is deep (long username, nested CI workspaces, MSYS-style temp roots) pushing helper path length to >= 260 UTF-16 units. ensure_temp_dir_can_replace_binary() runs before any file is moved.","commonSituations":"Machines with long corporate usernames (C:\\Users\\<40+chars>\\AppData\\Local\\Temp); CI runners with deep workspace temp paths; aggressive TEMP overrides into nested project dirs.","solutions":["Run in PowerShell: `$env:TEMP = 'C:\\Temp'; $env:TMP = 'C:\\Temp'` then `mise self-update`","Make the short directory first: `mkdir C:\\Temp` if it does not exist","Longer term: enable long-path support or use a shorter Windows username/profile"],"exampleFix":"# before\nmise self-update   # TEMP deep under the user profile\n# after (PowerShell)\nmkdir C:\\Temp -Force\n$env:TEMP = 'C:\\Temp'; $env:TMP = 'C:\\Temp'\nmise self-update","handlingStrategy":"validation","validationCode":"# PowerShell: verify TEMP is short enough before self-update\n$helperLen = ($env:TEMP + '\\mise-self-update-helper-<stem>.exe').Length\nif ($helperLen -ge 260) { $env:TEMP = 'C:\\Temp'; $env:TMP = 'C:\\Temp' }\nmise self-update","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set TEMP/TMP to a short root like C:\\Temp in Windows CI images and long-username machines","Budget ~260 UTF-16 code units for the whole helper path, including the mise stem, when picking TEMP"],"tags":["self-update","windows","max-path","temp-directory"],"backgroundTag":"windows-path-too-long","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}