jdx/mise · error

cli-spec entry names {bin:?} in format {format:?}

Error message

cli-spec entry names {bin:?} in format {format:?}

What it means

For SpecExec completion sources, the packslip names the binary and spec format whose generated spec will be cached as <bin>.<format>. mise validates both are plain file names before using them in the cache path; if either contains path separators or unsafe components, it refuses, since a non-plain name could escape the specs directory or collide across shells.

Source

Thrown at src/packslip.rs:1234

        let attempt = match source {
            CompletionSource::File(path) => file::read_to_string(&path),
            CompletionSource::Spec { format, bin, path } => {
                derive_from_spec(&format, &bin, &path, shell)
            }
            CompletionSource::Exec(argv, env) => run_tool(config, &backend, &tv, &argv, &env).await,
            CompletionSource::SpecExec {
                format,
                bin,
                argv,
                env,
            } => {
                // Any failure here is one more reason to try the next source,
                // not the end of the search. The spec is kept in the install:
                // a script derived from it names the file at completion time,
                // so it has to outlive this command.
                async {
                    if !file::is_plain_file_name(&bin) || !file::is_plain_file_name(&format) {
                        bail!("cli-spec entry names {bin:?} in format {format:?}");
                    }
                    let spec = run_tool(config, &backend, &tv, &argv, &env).await?;
                    // A spec generated for one shell, as `{shell}` in the
                    // command allows, is not the spec for another, and two
                    // shells generating at once must not read each other's
                    // half-written file. `shell` is a plain file name: the
                    // cache path above refuses anything else.
                    let dir = install_path.join(RESOURCES_DIR).join("specs").join(shell);
                    file::create_dir_all(&dir)?;
                    let path = dir.join(format!("{bin}.{format}"));
                    file::write_atomic(&path, &spec)?;
                    derive_from_spec(&format, &bin, &path, shell)
                }
                .await
            }
        };
        match attempt {
            Ok(script) if script.trim().is_empty() => {

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Inspect the packslip statement's cli-spec entry and set bin to the bare executable name and format to a bare token like "usage".
  2. Reinstall from a corrected packslip release: `mise packslip forget <project> && mise install <tool>`.
  3. If the statement was hand-edited, restore it by reinstalling the tool version.

Example fix

// packslip cli-spec — before
[[resource]]
type = "cli-spec"
bin = "bin/mytool"
format = "usage"
// after
[[resource]]
type = "cli-spec"
bin = "mytool"
format = "usage"
Defensive patterns

Strategy: validation

Validate before calling

fn plain_name(s: &str) -> bool { !s.is_empty() && !s.contains(['/', '\\']) && s != "." && s != ".." }
// for each cli-spec entry in the statement:
assert!(plain_name(entry.bin) && plain_name(entry.format));

Type guard

fn valid_spec_entry(bin: &str, format: &str) -> bool { is_plain_file_name(bin) && is_plain_file_name(format) }

Try / catch

if !valid_spec_entry(&entry.bin, &entry.format) {
    eprintln!("skipping malformed cli-spec entry {:?}/{:?}", entry.bin, entry.format);
    // try the next completion source
}

Prevention

When it happens

Trigger: Running `mise completion <shell> --tool <tool>` where the packslip's cli-spec exec entry declares a bin or format string that is not a plain file name (contains '/', '\\', '..', or is empty).

Common situations: A mis-authored packslip cli-spec entry with a path-qualified bin name (e.g. "bin/tool") or an unusual format string; a corrupted or hand-edited packslip statement.

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/7a4758649a4e2db7. Report an issue: GitHub.