zeroclaw-labs/zeroclaw · error · anyhow::Error
grok_cli extra_args option `{flag}` is missing its value and
Error message
grok_cli extra_args option `{flag}` is missing its value and could consume the provider-owned ACP command What it means
A known value-taking flag (VALUE_TAKING_EXTRA_ARG_FLAGS: --sandbox, --tools, --permission-mode, --agent, --max-turns, ...) appeared as the final token with no following value. Validation aborts because if it were forwarded as-is, the option would consume the provider-owned trailing 'agent stdio' ACP command tokens as its value.
Source
Thrown at crates/zeroclaw-providers/src/grok_cli.rs:574
"grok_cli extra_args accepts long flags only and must not include positional arguments"
);
}
let (flag, has_inline_value) = arg
.split_once('=')
.map_or((arg.as_str(), false), |(flag, _)| (flag, true));
if RESERVED_EXTRA_ARG_FLAGS.contains(&flag) {
anyhow::bail!(
"grok_cli extra_args must not include reserved flag `{flag}`. \
ACP transport, prompt, model, session, cwd, and update policy are owned by ZeroClaw."
);
}
if has_inline_value || VALUELESS_EXTRA_ARG_FLAGS.contains(&flag) {
index += 1;
continue;
}
if VALUE_TAKING_EXTRA_ARG_FLAGS.contains(&flag) {
let Some(value) = extra_args.get(index + 1) else {
anyhow::bail!(
"grok_cli extra_args option `{flag}` is missing its value and could consume the provider-owned ACP command"
);
};
if value.starts_with('-') {
anyhow::bail!(
"grok_cli extra_args option `{flag}` must use `--flag=value` when its value starts with `-`"
);
}
index += 2;
continue;
}
anyhow::bail!(
"grok_cli extra_args option `{flag}` must use `--flag=value` because its argument shape is not known"
);
}
Ok(extra_args)
}
View on GitHub (pinned to 88bb9c8533)
Solutions
- Append the value: ['--sandbox','strict'] or use the inline form '--sandbox=strict'
- Use the --flag=value form everywhere to eliminate pairing mistakes
- Recount pairs after editing the array
Example fix
# before extra_args = ["--sandbox"] # after extra_args = ["--sandbox=strict"]
Defensive patterns
Strategy: validation
Validate before calling
const VALUE_TAKING: &[&str] = &["--agent", "--allow", "--deny", "--effort",
"--max-turns", "--permission-mode", "--reasoning-effort", "--rules",
"--sandbox", "--tools"];
fn extra_args_fully_valued(args: &[String]) -> bool {
let mut i = 0;
while i < args.len() {
let (flag, inline) = args[i].split_once('=')
.map_or((args[i].as_str(), false), |(f, _)| (f, true));
if VALUE_TAKING.contains(&flag) {
if inline { i += 1; continue; }
if i + 1 >= args.len() { return false; } // would eat 'agent stdio'
i += 2;
} else { i += 1; }
}
true
} Type guard
fn extra_args_fully_valued(args: &[String]) -> bool {
let mut i = 0;
while i < args.len() {
let (flag, inline) = args[i].split_once('=')
.map_or((args[i].as_str(), false), |(f, _)| (f, true));
if ["--sandbox", "--tools", "--permission-mode", "--max-turns"].contains(&flag) {
if inline { i += 1; continue; }
if i + 1 >= args.len() { return false; }
i += 2;
} else { i += 1; }
}
true
} Prevention
- Standardize on --flag=value form for all extra_args
- Pair-check value-taking flags in config linting
- Never let extra_args end with a bare value-taking flag
When it happens
Trigger: extra_args ends with a bare '--sandbox' or '--tools'; list misalignment where a value-taking flag is followed by another flag; truncated config after an edit.
Common situations: Hand-edited TOML arrays losing the last element; mixed '--flag value' and '--flag=value' styles confusing pairing; values starting with '-' hit the sibling rule instead.
Related errors
- grok_cli extra_args accepts long flags only and must not inc
- grok_cli extra_args must not include reserved flag `{flag}`.
- grok_cli requires an explicit working_directory for the ACP
- grok_cli working_directory must be an absolute path
- grok_cli working_directory must identify a directory
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/f735109a891211ce.
Report an issue: GitHub.