jdx/mise · error

failed to split activation flags

Error message

failed to split activation flags

What it means

mise panics in bash activation rendering (src/shell/bash.rs render_flags_array) when the configured activation flags string cannot be tokenized by shell_words::split. The flags value is expected to be a shell-parseable list of words; unbalanced quotes or an unterminated escape sequence make it unparseable, so instead of emitting a broken shell snippet, mise fails fast.

Source

Thrown at src/shell/bash.rs:25

use crate::env;
use crate::shell::{self, ActivateOptions, Shell};

#[derive(Default)]
pub(super) struct Bash {}

impl Bash {}

fn render_template(template: &str, replacements: &[(&str, &str)]) -> String {
    let mut out = template.to_owned();
    for (needle, value) in replacements {
        out = out.replace(needle, value);
    }
    out
}

fn render_flags_array(value: &str) -> String {
    shell_words::split(value)
        .expect("failed to split activation flags")
        .into_iter()
        .map(|word| escape(word.into()).to_string())
        .collect::<Vec<_>>()
        .join(" ")
}

impl Shell for Bash {
    fn activate(&self, opts: ActivateOptions) -> String {
        let exe = opts.exe;
        let settings = Settings::get();

        let exe = exe.to_string_lossy();
        let exe = escape(crate::windows_posix::executable_for_shell(&exe));
        let flags = render_flags_array(&opts.flags);

        let mut out = String::new();

        out.push_str(&shell::build_deactivation_script(self));

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Fix the activation flags value: ensure balanced quotes and no trailing backslashes (e.g. MISE_ACTIVATION_FLAGS="--quiet --no-modify-path").
  2. Unset the flags variable/setting to fall back to defaults: unset MISE_ACTIVATION_FLAGS or remove it from settings.toml.
  3. Inspect the exact value with echo "$MISE_ACTIVATION_FLAGS" | cat -A to reveal hidden or mismatched quote characters.

Example fix

// before
export MISE_ACTIVATION_FLAGS="--quiet --status'"
// after
export MISE_ACTIVATION_FLAGS="--quiet --status"
Defensive patterns

Strategy: validation

Validate before calling

# shell check before exporting
echo "$MISE_ACTIVATION_FLAGS" | tr " '" '\n' | awk 'NR%2==0{exit 1}' || echo "unbalanced quotes"

Prevention

When it happens

Trigger: MISE_ACTIVATION_FLAGS or the corresponding setting contains unbalanced quotes, trailing backslash, or other input shell_words::split rejects, while rendering the bash activate script.

Common situations: Users copy-pasting flags with curly/smart quotes; setting flags like --no-modify-path' without a closing quote; CI env vars interpolated with stray spaces or quotes into the flags value.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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