jdx/mise · error

Windows script file name

Error message

Windows script file name {filename:?} contains unsupported characters

What it means

The script file being wrapped into a Windows .cmd launcher must have a simple ASCII filename (alphanumerics, `.`, `_`, `-`), because the filename is embedded verbatim in the generated command line (`%~dp0<filename>`). Names with spaces, quotes, or non-ASCII characters would break or corrupt the launcher, so mise bails first.

Solutions

  1. Rename the script to a plain name (e.g. `my_script.py`) before/instead of launching
  2. Wrap the oddly-named script with a simple-named shim script
  3. If the file comes from a package, patch or report the upstream asset naming

Example fix

// before
my script.py    # fails
// after
my_script.py
Defensive patterns

Strategy: validation

Validate before calling

// bash: reject script filenames unsafe for a .cmd launcher
f="$(basename "$script")"
[[ "$f" =~ ^[A-Za-z0-9._-]+$ ]] || { echo "rename $f to a plain name"; exit 1; }

Type guard

// rust
fn is_safe_script_name(s: &str) -> bool {
    !s.is_empty() && s.chars().all(|c| c.is_ascii_alphanumeric() || matches!(c, '.' | '_' | '-'))
}

Prevention

When it happens

Trigger: Writing a Windows script launcher for a script whose filename contains spaces, shell metacharacters, or non-ASCII characters (e.g. `my script.sh`, `run(tool).py`).

Common situations: Upstream packages shipping script assets with spaces or special characters in their names; non-English locales producing Unicode file names in installed packages.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/6058f4dbf7687f81. Report an issue: GitHub.

Appendix: source

Thrown at src/backend/http.rs:1055

    ensure_plain_bin_name("windows_script_interpreter", interpreter)?;
    if interpreter.is_empty()
        || !interpreter
            .chars()
            .all(|ch| ch.is_ascii_alphanumeric() || matches!(ch, '.' | '_' | '-'))
    {
        eyre::bail!("windows_script_interpreter: {interpreter:?} must be a plain executable name");
    }
    let filename = script
        .file_name()
        .and_then(|filename| filename.to_str())
        .ok_or_else(|| eyre::eyre!("Windows script launcher requires a UTF-8 file name"))?;
    ensure_plain_bin_name("windows script", filename)?;
    if filename.is_empty()
        || !filename
            .chars()
            .all(|ch| ch.is_ascii_alphanumeric() || matches!(ch, '.' | '_' | '-'))
    {
        eyre::bail!("Windows script file name {filename:?} contains unsupported characters");
    }
    let launcher = script.with_file_name(format!("{filename}.cmd"));
    let body = format!("@echo off\r\n{interpreter} \"%~dp0{filename}\" %*\r\n");
    Ok((launcher, body))
}

#[cfg(windows)]
fn write_windows_script_launcher(script: &Path, interpreter: &str) -> Result<()> {
    let (launcher, body) = windows_script_launcher(script, interpreter)?;
    file::write(launcher, body)
}

/// Returns install-time-only option keys for HTTP backend.
pub(crate) fn install_time_option_keys() -> Vec<String> {
    vec![
        "url".into(),
        "checksum".into(),
        "version_list_url".into(),

View on GitHub (pinned to 533346cc37)