jdx/mise · error

{message}

Error message

{message}

What it means

string_array converts a TOML array into a Vec<String> for bootstrap hook commands. Any element that is not a TOML string causes it to bail with the caller-supplied message (e.g. 'expected string commands' or 'expected `run` to contain string commands'), so arrays containing numbers, booleans, or nested tables are rejected.

Source

Thrown at src/system/hooks.rs:125

                } else {
                    Some(Self {
                        phase,
                        run,
                        config_path: config_path.clone(),
                    })
                }
            })
            .collect();
        Ok(hooks)
    }
}

fn string_array(values: Vec<toml::Value>, message: &str) -> Result<Vec<String>> {
    let mut out = vec![];
    for value in values {
        match value {
            toml::Value::String(s) => out.push(s),
            _ => bail!("{message}"),
        }
    }
    Ok(out)
}

pub(crate) async fn run_phase(
    config: &Config,
    hooks: &[BootstrapHook],
    phase: BootstrapHookPhase,
    dry_run: bool,
) -> Result<()> {
    let phase_hooks: Vec<_> = hooks.iter().filter(|hook| hook.phase == phase).collect();
    if phase_hooks.is_empty() {
        return Ok(());
    }
    info!("bootstrap: {phase} hooks");
    let shell = Settings::get().default_inline_shell()?;
    let Some((program, shell_args)) = shell.split_first() else {

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Quote every element of the array so all are strings: `run = ["echo one", "echo two"]`.
  2. Locate the non-string element flagged by the message and fix or remove it.
  3. If a command contains characters TOML misinterprets, wrap it in single or double quotes.

Example fix

// before
[bootstrap_hooks]
init = ["echo one", 42]
// after
[bootstrap_hooks]
init = ["echo one", "echo 42"]
Defensive patterns

Strategy: validation

Validate before calling

# every array element must be a quoted string
# bad:  run = ["cmd", 42]
# good: run = ["cmd", "echo 42"]

Try / catch

match result {
    Err(e) if e.to_string().contains("expected string commands") || e.to_string().contains("expected `run` to contain string commands") => {
        eprintln!("quote every element in the command array");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Passing an array to a bootstrap hook (either directly or via `run = [...]`) where one or more elements are not strings, e.g. `run = ["echo hi", 42]` or `init = ["cmd", true]`.

Common situations: Mixed-type arrays from careless TOML editing, forgetting quotes around a command, or programmatic config generation emitting numbers/booleans in a command list.

Related errors


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