jdx/mise · error · eyre::Report

install_command must be a non-empty string

Error message

install_command must be a non-empty string

What it means

The spm backend's `install_command` option must be a TOML string. This variant of the error is thrown when the option exists but is not a string at all — an array, table, integer, or boolean.

Source

Thrown at src/backend/spm.rs:142

                .filter_map(|v| v.as_str().map(|s| s.trim().to_string()))
                .filter(|s| !s.is_empty())
                .collect(),
            toml::Value::String(s) => s
                .split(',')
                .map(|s| s.trim().to_string())
                .filter(|s| !s.is_empty())
                .collect(),
            _ => return None,
        };
        if bins.is_empty() { None } else { Some(bins) }
    }

    fn install_command(&self) -> eyre::Result<Option<String>> {
        let Some(value) = self.values.raw().opts.get("install_command") else {
            return Ok(None);
        };
        let Some(command) = value.as_str() else {
            bail!("install_command must be a non-empty string");
        };
        let command = command.trim();
        if command.is_empty() {
            bail!("install_command must be a non-empty string");
        }
        Ok(Some(command.to_string()))
    }

    fn source_install_command(&self) -> eyre::Result<Option<String>> {
        let command = self.install_command()?;
        if command.is_some() && self.filter_bins().is_some() {
            bail!("install_command cannot be used with filter_bins");
        }
        Ok(command)
    }
}

#[async_trait]

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Provide a single shell string: `install_command = "make install"`
  2. Put complex commands in one string and rely on shell invocation, or move logic to a script the string calls

Example fix

# before
[tools."spm:foo/bar"]
version = "1.0.0"
install_command = ["make", "install"]

# after
[tools."spm:foo/bar"]
version = "1.0.0"
install_command = "make install"
Defensive patterns

Strategy: validation

Validate before calling

! grep -RnE 'install_command[[:space:]]*=[[:space:]]*[\[{]' mise.toml

Type guard

fn is_string_option(v: &toml::Value) -> bool { v.is_str() }

Prevention

When it happens

Trigger: Writing `install_command = ["make", "install"]` or `install_command = { cmd = "make install" }` in a spm tool entry; the value is fetched raw from opts and as_str() is attempted before any trimming.

Common situations: Porting a task-style array command syntax into a tool option, or assuming install_command accepts argv arrays like some other config keys.

Understand the failure class

Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.

Related errors


AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22). Data as JSON: /api/errors/9fa25c153acf9bb4. Report an issue: GitHub.