jdx/mise · error
--tool-option requires a non-empty key
Error message
--tool-option requires a non-empty key
What it means
`mise use --tool-option` parses each occurrence as KEY=VALUE. An occurrence whose key part (before '=') is empty — e.g. `--tool-option =foo` or `--tool-option " =foo"` — is rejected because an option with no name cannot be recorded.
Solutions
- Provide KEY=VALUE with a non-empty key: --tool-option verbose=true
- Quote the whole argument so the shell does not split or drop parts: --tool-option "key=value"
- Check the variable feeding the flag: echo "[$OPT]" to see the actual expansion
Example fix
// before mise use --tool-option "=true" node // after mise use --tool-option "verbose=true" node
Defensive patterns
Strategy: validation
Validate before calling
for (const opt of toolOptions) {
const i = opt.indexOf('=');
if (i <= 0 || !opt.slice(0,i).trim()) throw new Error(`--tool-option needs KEY=VALUE, got: ${opt}`);
} Type guard
const isValidToolOption = (s: string): s is `${string}=${string}` => {
const i = s.indexOf('=');
return i > 0 && s.slice(0, i).trim().length > 0;
}; Try / catch
try { exec(`mise use ${flags} ${tool}`); } catch (e) { if (String(e).includes('non-empty key')) console.error('each --tool-option must be KEY=VALUE with a non-empty KEY'); throw e; } Prevention
- Always quote --tool-option arguments in shell
- Assert shell variables feeding keys are non-empty before building the command
- Keep option flags in one place (config file) to avoid hand-built flag strings
When it happens
Trigger: Passing `--tool-option "=value"` or `--tool-option " =value"` via CLI, or a flag built from a shell variable that expanded to an empty key.
Common situations: Shell variable interpolation yielding an empty key (OPT=""; mise use --tool-option "$OPT=1"); hand-edited scripts dropping the key; copy-paste of flags losing the key before '='.
Understand the failure class
Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.
Related errors
- a repository preview directory requires a dry run
- `--all` needs `--to
- at least one target or --changed is required
- cannot combine with an inline option for
- cannot replace task stub directory because
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/67dd16868fb180a7.
Report an issue: GitHub.
Appendix: source
Thrown at src/cli/use.rs:198
}
fn request_options(&self) -> Result<ToolVersionOptions> {
let mut options = ToolVersionOptions::default();
let mut entries = Vec::new();
if let Some(command) = &self.postinstall {
entries.push((
"postinstall".to_string(),
toml::Value::String(command.clone()),
"--postinstall",
));
}
for option in &self.tool_option {
let (key, value) = option
.split_once('=')
.ok_or_else(|| eyre!("--tool-option expects KEY=VALUE: {option}"))?;
let key = key.trim();
if key.is_empty() {
bail!("--tool-option requires a non-empty key");
}
let value = toml::from_str::<toml::Table>(&format!("value = {value}"))
.ok()
.filter(|table| table.len() == 1)
.and_then(|mut table| table.remove("value"))
.unwrap_or_else(|| toml::Value::String(value.to_string()));
entries.push((key.to_string(), value, "--tool-option"));
}
let mut seen = std::collections::HashSet::new();
for (key, value, flag) in entries {
if !seen.insert(key.clone()) {
bail!(
"tool option {key:?} was specified more than once for {}",
self.tool
);
}
if self
.toolView on GitHub (pinned to 533346cc37)