zeroclaw-labs/zeroclaw · error · anyhow::Error
grok_cli extra_args accepts long flags only and must not inc
Error message
grok_cli extra_args accepts long flags only and must not include positional arguments
What it means
extra_args accepts long flags only: after trimming, every token must start with '--' and must not be the bare '--' separator. Short flags, positional arguments, and subcommands are rejected outright so they can never be confused with the provider-owned trailing ACP command tokens.
Source
Thrown at crates/zeroclaw-providers/src/grok_cli.rs:555
// Preserve the operator-supplied spelling; equality is
// case-insensitive on Windows when checking membership later.
normalized.push(name.to_string());
}
}
Ok(normalized)
}
fn normalize_and_validate_extra_args(extra_args: Vec<String>) -> anyhow::Result<Vec<String>> {
let extra_args: Vec<String> = extra_args
.into_iter()
.map(|arg| arg.trim().to_string())
.filter(|arg| !arg.is_empty())
.collect();
let mut index = 0;
while index < extra_args.len() {
let arg = &extra_args[index];
if arg == "--" || !arg.starts_with("--") {
anyhow::bail!(
"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 {View on GitHub (pinned to 88bb9c8533)
Solutions
- Keep only long flags ('--no-plan', '--verbatim') in extra_args
- Express values as --flag=value
- Drop subcommands and positional file arguments; they are not configurable here
Example fix
# before extra_args = ["-v", "agent", "stdio"] # after extra_args = ["--verbatim"]
Defensive patterns
Strategy: validation
Validate before calling
fn extra_args_shape_ok(args: &[String]) -> bool {
args.iter().all(|a| a.starts_with("--") && a.as_str() != "--")
} Type guard
fn extra_args_shape_ok(args: &[String]) -> bool {
args.iter().all(|a| a.starts_with("--") && a.as_str() != "--")
} Prevention
- Never paste raw command lines into extra_args; extract flags only
- Prefer the --flag=value form exclusively
- Reject short flags and positionals in config linting
When it happens
Trigger: Configuring extra_args = ['-v'], ['agent'], ['--'], or ['--verbatim','notes.txt']; pasting a full grok command line including its subcommand into the list.
Common situations: Migrating a manual `grok ... agent stdio` invocation; muscle-memory short flags; passing file arguments that are positionals.
Related errors
- grok_cli env_passthrough entry `{name}` is invalid; expected
- grok_cli extra_args must not include reserved flag `{flag}`.
- grok_cli extra_args option `{flag}` is missing its value and
- cloud_ops.iac_tools must not be empty when cloud_ops is enab
- gateway.path_prefix contains invalid character '{bad}'; only
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/e6dc5fc349261436.
Report an issue: GitHub.