{"record":{"id":"6058f4dbf7687f81","repo":"jdx/mise","slug":"windows-script-file-name-filename-contains-uns","errorCode":null,"errorMessage":"Windows script file name {filename:?} contains unsupported characters","messagePattern":"Windows script file name (.+?) contains unsupported characters","errorType":"validation","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/backend/http.rs","lineNumber":1007,"sourceCode":"    ensure_plain_bin_name(\"windows_script_interpreter\", interpreter)?;\n    if interpreter.is_empty()\n        || !interpreter\n            .chars()\n            .all(|ch| ch.is_ascii_alphanumeric() || matches!(ch, '.' | '_' | '-'))\n    {\n        eyre::bail!(\"windows_script_interpreter: {interpreter:?} must be a plain executable name\");\n    }\n    let filename = script\n        .file_name()\n        .and_then(|filename| filename.to_str())\n        .ok_or_else(|| eyre::eyre!(\"Windows script launcher requires a UTF-8 file name\"))?;\n    ensure_plain_bin_name(\"windows script\", filename)?;\n    if filename.is_empty()\n        || !filename\n            .chars()\n            .all(|ch| ch.is_ascii_alphanumeric() || matches!(ch, '.' | '_' | '-'))\n    {\n        eyre::bail!(\"Windows script file name {filename:?} contains unsupported characters\");\n    }\n    let launcher = script.with_file_name(format!(\"{filename}.cmd\"));\n    let body = format!(\"@echo off\\r\\n{interpreter} \\\"%~dp0{filename}\\\" %*\\r\\n\");\n    Ok((launcher, body))\n}\n\n#[cfg(windows)]\nfn write_windows_script_launcher(script: &Path, interpreter: &str) -> Result<()> {\n    let (launcher, body) = windows_script_launcher(script, interpreter)?;\n    file::write(launcher, body)\n}\n\n/// Returns install-time-only option keys for HTTP backend.\npub(crate) fn install_time_option_keys() -> Vec<String> {\n    vec![\n        \"url\".into(),\n        \"checksum\".into(),\n        \"version_list_url\".into(),","sourceCodeStart":989,"sourceCodeEnd":1025,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/backend/http.rs#L989-L1025","documentation":"When generating a Windows .cmd launcher for an http tool, the script's own file name is embedded unquoted into the batch body (`\"%~dp0{filename}\"` line and the launcher file name `{filename}.cmd`). To keep both well-formed and injection-safe, the file name must be non-empty ASCII alphanumeric plus `.`, `_`, `-`; anything else is rejected.","triggerScenarios":"Installing an http: tool on Windows whose URL ends in a script file name containing spaces, unicode, or special characters (e.g. `my tool-v2.py`, `café.sh`, `tool$(x).js`), when a windows_script_interpreter is configured.","commonSituations":"Downloading scripts from URLs with human-friendly names ('My Tool.ps1'); URLs with percent-encoded unicode decoded to non-ASCII names; mirrored/hosted scripts renamed casually.","solutions":["Change/rename the URL so the script's base name is simple ASCII (host a copy like `tool.py`)","Download the script yourself into a custom tool layout with a safe name instead of the http backend's launcher path","Avoid file names with spaces or non-ASCII characters for scripts installed via mise on Windows"],"exampleFix":"# before\n[tools]\n\"http://example.com/My Great Script.py\" = \"latest\"\n# after\n[tools]\n\"http://example.com/my-great-script.py\" = \"latest\"","handlingStrategy":"validation","validationCode":"# gate the script file name before adding the tool (ASCII simple name only)\n[[ \"$(basename \"$url\")\" =~ ^[A-Za-z0-9._-]+$ ]] || echo 'rename the script file'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep http tool URLs pointing at simple ASCII file names (no spaces/unicode)","Host renamed copies of third-party scripts you install via mise on Windows"],"tags":["windows","file-name","script-launcher","input-validation","http-backend"],"backgroundTag":"invalid-file-name","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}