jdx/mise · error

invalid command wrapper name: {name:?}

Error message

invalid command wrapper name: {name:?}

What it means

Command wrapper names must be valid, plain executable names: non-empty, not '.' or '..', and containing no path separators ('/' or '\\'). validate_wrapper_name rejects any name violating these rules because wrappers are keyed as command names, not paths.

Source

Thrown at src/shims.rs:1130

        a == b
    }
}

pub(crate) fn command_name_without_exe_suffix(bin_name: &str) -> &str {
    let suffix = std::env::consts::EXE_SUFFIX;
    if suffix.is_empty() {
        return bin_name;
    }
    let suffix_start = bin_name.len().saturating_sub(suffix.len());
    match (bin_name.get(..suffix_start), bin_name.get(suffix_start..)) {
        (Some(name), Some(actual_suffix)) if actual_suffix.eq_ignore_ascii_case(suffix) => name,
        _ => bin_name,
    }
}

fn validate_wrapper_name(name: &str) -> Result<()> {
    if name.is_empty() || name == "." || name == ".." || name.contains('/') || name.contains('\\') {
        bail!("invalid command wrapper name: {name:?}");
    }
    if cfg!(windows) && name.contains('.') {
        bail!("command wrapper names cannot contain dots on Windows: {name:?}");
    }
    Ok(())
}

fn validate_wrapper_names<'a>(names: impl IntoIterator<Item = &'a String>) -> Result<()> {
    let mut normalized = HashSet::new();
    for name in names {
        validate_wrapper_name(name)?;
        if cfg!(macos) && !normalized.insert(name.to_lowercase()) {
            bail!("command wrapper names collide on macOS after case normalization: {name:?}");
        }
    }
    Ok(())
}

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Use just the executable name as the wrapper key (e.g. `foo`, not `bin/foo`).
  2. Strip the directory portion: use the basename of the path you intended.
  3. If you meant to wrap a tool in a subdirectory, configure the wrapper's *command* with the full path and keep the name a plain identifier.
  4. Fix empty/`.`/`..` entries by giving the wrapper an explicit name.

Example fix

// before
[wrapper]
"bin/ruff" = "ruff --fix" // path separator invalid

// after
[wrapper]
ruff = "/full/path/to/ruff --fix"
Defensive patterns

Strategy: validation

Validate before calling

// bash: validate a wrapper name before adding it
validate_wrapper_name() {
  case "$1" in
    ""|.|..|*/*|*\\*) echo "invalid wrapper name: $1"; return 1;;
    *) return 0;;
  esac
}
validate_wrapper_name "bin/ruff" || echo 'use basename only'

Prevention

When it happens

Trigger: Declaring a wrapper key like `tools/mytool`, `sub\dir\cmd`, `.` or `..`, or an empty string in the command wrapper configuration (mise.toml wrapper section or `mise wrapper add` argument).

Common situations: Users pasting a file path where only the command name belongs, typos with trailing slashes, or generating wrapper names programmatically from paths without taking the basename.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


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