{"record":{"id":"f735109a891211ce","repo":"zeroclaw-labs/zeroclaw","slug":"grok-cli-extra-args-option-flag-is-missing-its","errorCode":null,"errorMessage":"grok_cli extra_args option `{flag}` is missing its value and could consume the provider-owned ACP command","messagePattern":"grok_cli extra_args option `(.+?)` is missing its value and could consume the provider-owned ACP command","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-providers/src/grok_cli.rs","lineNumber":574,"sourceCode":"                    \"grok_cli extra_args accepts long flags only and must not include positional arguments\"\n                );\n            }\n            let (flag, has_inline_value) = arg\n                .split_once('=')\n                .map_or((arg.as_str(), false), |(flag, _)| (flag, true));\n            if RESERVED_EXTRA_ARG_FLAGS.contains(&flag) {\n                anyhow::bail!(\n                    \"grok_cli extra_args must not include reserved flag `{flag}`. \\\n                     ACP transport, prompt, model, session, cwd, and update policy are owned by ZeroClaw.\"\n                );\n            }\n            if has_inline_value || VALUELESS_EXTRA_ARG_FLAGS.contains(&flag) {\n                index += 1;\n                continue;\n            }\n            if VALUE_TAKING_EXTRA_ARG_FLAGS.contains(&flag) {\n                let Some(value) = extra_args.get(index + 1) else {\n                    anyhow::bail!(\n                        \"grok_cli extra_args option `{flag}` is missing its value and could consume the provider-owned ACP command\"\n                    );\n                };\n                if value.starts_with('-') {\n                    anyhow::bail!(\n                        \"grok_cli extra_args option `{flag}` must use `--flag=value` when its value starts with `-`\"\n                    );\n                }\n                index += 2;\n                continue;\n            }\n            anyhow::bail!(\n                \"grok_cli extra_args option `{flag}` must use `--flag=value` because its argument shape is not known\"\n            );\n        }\n        Ok(extra_args)\n    }\n","sourceCodeStart":556,"sourceCodeEnd":592,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-providers/src/grok_cli.rs#L556-L592","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nextra_args = [\"--sandbox\"]\n\n# after\nextra_args = [\"--sandbox=strict\"]","handlingStrategy":"validation","validationCode":"const VALUE_TAKING: &[&str] = &[\"--agent\", \"--allow\", \"--deny\", \"--effort\",\n    \"--max-turns\", \"--permission-mode\", \"--reasoning-effort\", \"--rules\",\n    \"--sandbox\", \"--tools\"];\n\nfn extra_args_fully_valued(args: &[String]) -> bool {\n    let mut i = 0;\n    while i < args.len() {\n        let (flag, inline) = args[i].split_once('=')\n            .map_or((args[i].as_str(), false), |(f, _)| (f, true));\n        if VALUE_TAKING.contains(&flag) {\n            if inline { i += 1; continue; }\n            if i + 1 >= args.len() { return false; } // would eat 'agent stdio'\n            i += 2;\n        } else { i += 1; }\n    }\n    true\n}","typeGuard":"fn extra_args_fully_valued(args: &[String]) -> bool {\n    let mut i = 0;\n    while i < args.len() {\n        let (flag, inline) = args[i].split_once('=')\n            .map_or((args[i].as_str(), false), |(f, _)| (f, true));\n        if [\"--sandbox\", \"--tools\", \"--permission-mode\", \"--max-turns\"].contains(&flag) {\n            if inline { i += 1; continue; }\n            if i + 1 >= args.len() { return false; }\n            i += 2;\n        } else { i += 1; }\n    }\n    true\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["rust","zeroclaw","grok-cli","cli-arguments","missing-value","configuration"],"backgroundTag":"missing-cli-option-value","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}