jdx/mise · error
failed to split activation flags
Error message
failed to split activation flags
What it means
render_flags_array splits the configured activation flags string with shell_words::split and unwraps with expect, panicking if the string contains unbalanced quotes or an unterminated escape. shell_words follows POSIX shell tokenization, so malformed quoting makes the value unsplittable.
Solutions
- Fix the activation flags value so it is valid POSIX shell syntax (balanced quotes, complete escapes)
- Unset the flags option to fall back to defaults
- Test the string with `sh -c 'for f in <your flags>; do echo $f; done'` before saving it
Example fix
// before MISE_ACTIVATE_FLAGS="--no-rc 'unterminated" // after MISE_ACTIVATE_FLAGS="--no-rc --noprofile"
Defensive patterns
Strategy: validation
Validate before calling
// validate flags before configuring
if shlex::split(flags).is_none() {
eprintln!("invalid activation flags: unbalanced quotes");
} Try / catch
match shell_words::split(value) {
Ok(words) => words,
Err(e) => { eprintln!("bad activation flags: {e}"); Default::default() }
} Prevention
- Quote flag values with plain ASCII quotes
- Validate shell syntax of config strings before saving
- Test activation output in a fresh shell after changing flags
When it happens
Trigger: A user sets mise's activation flags setting (e.g. in settings or config) to a string with unbalanced quotes, a lone backslash, or otherwise invalid shell syntax; the activate command for bash then panics in render_flags_array.
Common situations: Copy-pasting flags with smart quotes or missing closing quote; setting flags like --no-init-files " without the closing quote; environment-variable interpolation introducing stray characters.
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
- a provided source resolves to a path
- at least one bin path should exist
- config index exists
- declaring bootstrap config is loaded
- default inline shell args must not be empty
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/b84ca6b3dafb2d5d.
Report an issue: GitHub.
Appendix: 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 533346cc37)