{"record":{"id":"e6dc5fc349261436","repo":"zeroclaw-labs/zeroclaw","slug":"grok-cli-extra-args-accepts-long-flags-only-and-mu","errorCode":null,"errorMessage":"grok_cli extra_args accepts long flags only and must not include positional arguments","messagePattern":"grok_cli extra_args accepts long flags only and must not include positional arguments","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-providers/src/grok_cli.rs","lineNumber":555,"sourceCode":"                // Preserve the operator-supplied spelling; equality is\n                // case-insensitive on Windows when checking membership later.\n                normalized.push(name.to_string());\n            }\n        }\n        Ok(normalized)\n    }\n\n    fn normalize_and_validate_extra_args(extra_args: Vec<String>) -> anyhow::Result<Vec<String>> {\n        let extra_args: Vec<String> = extra_args\n            .into_iter()\n            .map(|arg| arg.trim().to_string())\n            .filter(|arg| !arg.is_empty())\n            .collect();\n        let mut index = 0;\n        while index < extra_args.len() {\n            let arg = &extra_args[index];\n            if arg == \"--\" || !arg.starts_with(\"--\") {\n                anyhow::bail!(\n                    \"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 {","sourceCodeStart":537,"sourceCodeEnd":573,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-providers/src/grok_cli.rs#L537-L573","documentation":"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.","triggerScenarios":"Configuring extra_args = ['-v'], ['agent'], ['--'], or ['--verbatim','notes.txt']; pasting a full grok command line including its subcommand into the list.","commonSituations":"Migrating a manual `grok ... agent stdio` invocation; muscle-memory short flags; passing file arguments that are positionals.","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"],"exampleFix":"# before\nextra_args = [\"-v\", \"agent\", \"stdio\"]\n\n# after\nextra_args = [\"--verbatim\"]","handlingStrategy":"validation","validationCode":"fn extra_args_shape_ok(args: &[String]) -> bool {\n    args.iter().all(|a| a.starts_with(\"--\") && a.as_str() != \"--\")\n}","typeGuard":"fn extra_args_shape_ok(args: &[String]) -> bool {\n    args.iter().all(|a| a.starts_with(\"--\") && a.as_str() != \"--\")\n}","tryCatchPattern":null,"preventionTips":["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"],"tags":["rust","zeroclaw","grok-cli","cli-arguments","validation","configuration"],"backgroundTag":"invalid-cli-arguments","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}