{"record":{"id":"22c3a0a93cb095b7","repo":"zeroclaw-labs/zeroclaw","slug":"grok-cli-max-acp-stdout-bytes-must-be-between-a","errorCode":null,"errorMessage":"grok_cli max_acp_stdout_bytes must be between {} and {} bytes","messagePattern":"grok_cli max_acp_stdout_bytes must be between (.+?) and (.+?) bytes","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-providers/src/grok_cli.rs","lineNumber":507,"sourceCode":"            );\n        }\n        let path = Path::new(trimmed);\n        if !path.is_absolute() {\n            anyhow::bail!(\"grok_cli working_directory must be an absolute path\");\n        }\n        let canonical = std::fs::canonicalize(path).map_err(|_| {\n            anyhow::Error::msg(\"grok_cli working_directory does not exist or is inaccessible\")\n        })?;\n        if !canonical.is_dir() {\n            anyhow::bail!(\"grok_cli working_directory must identify a directory\");\n        }\n        Ok(canonical)\n    }\n\n    fn validate_acp_stdout_limit(value: Option<usize>) -> anyhow::Result<usize> {\n        let limit = value.unwrap_or(acp::DEFAULT_ACP_STDOUT_LIMIT_BYTES);\n        if !(acp::MIN_ACP_STDOUT_LIMIT_BYTES..=acp::MAX_ACP_STDOUT_LIMIT_BYTES).contains(&limit) {\n            anyhow::bail!(\n                \"grok_cli max_acp_stdout_bytes must be between {} and {} bytes\",\n                acp::MIN_ACP_STDOUT_LIMIT_BYTES,\n                acp::MAX_ACP_STDOUT_LIMIT_BYTES\n            );\n        }\n        Ok(limit)\n    }\n\n    fn normalize_and_validate_env_passthrough(names: Vec<String>) -> anyhow::Result<Vec<String>> {\n        let mut normalized: Vec<String> = Vec::with_capacity(names.len());\n        for name in names {\n            let name = name.trim();\n            if !is_valid_env_var_name(name) {\n                anyhow::bail!(\n                    \"grok_cli env_passthrough entry `{name}` is invalid; expected [A-Za-z_][A-Za-z0-9_]*\"\n                );\n            }\n            if is_disallowed_provider_env_var(name) {","sourceCodeStart":489,"sourceCodeEnd":525,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-providers/src/grok_cli.rs#L489-L525","documentation":"max_acp_stdout_bytes caps the ACP stdout reader and must lie in [1_048_576, 67_108_864] bytes (1 MiB to 64 MiB); the default is 4 MiB. The minimum equals MAX_ACP_FRAME_BYTES so no single valid ACP frame is ever rejected by the cap.","triggerScenarios":"Setting a sub-MiB limit (e.g. 65536 or 0) to 'save memory'; passing usize::MAX trying to disable the cap; confusing KiB and MiB units.","commonSituations":"Operators copying a bytes-looking number without unit math; attempts to disable limits on huge tool outputs; config generated from a different constant set.","solutions":["Choose a value within 1_048_576..=67_108_864 bytes","Omit the option to accept the 4 MiB default","Raise toward 64 MiB only when frames are genuinely larger"],"exampleFix":"# before\nmax_acp_stdout_bytes = 65536\n\n# after\nmax_acp_stdout_bytes = 8388608  # 8 MiB, within [1 MiB, 64 MiB]","handlingStrategy":"validation","validationCode":"const ACP_MIN: usize = 1_048_576;\nconst ACP_MAX: usize = 67_108_864;\nfn stdout_limit_ok(v: usize) -> bool { (ACP_MIN..=ACP_MAX).contains(&v) }","typeGuard":"fn stdout_limit_ok(v: usize) -> bool {\n    (1_048_576..=67_108_864).contains(&v)\n}","tryCatchPattern":null,"preventionTips":["Derive config values from the same constants, not magic numbers","Omit the key to take the 4 MiB default","Remember the floor exists so one max-size ACP frame always fits"],"tags":["rust","zeroclaw","grok-cli","acp","limits","configuration"],"backgroundTag":"config-out-of-range","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}