{"record":{"id":"f1cd3fe0a2e93e7e","repo":"zeroclaw-labs/zeroclaw","slug":"grok-cli-requires-an-explicit-working-directory-fo","errorCode":null,"errorMessage":"grok_cli requires an explicit working_directory for the ACP session boundary","messagePattern":"grok_cli requires an explicit working_directory for the ACP session boundary","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-providers/src/grok_cli.rs","lineNumber":487,"sourceCode":"impl GrokCliModelProvider {\n    /// Start a labelled construction chain for an ACP-backed provider.\n    pub fn builder(alias: &str) -> GrokCliBuilder {\n        GrokCliBuilder {\n            alias: alias.to_string(),\n            binary_path: None,\n            working_directory: None,\n            env_passthrough: Vec::new(),\n            extra_args: Vec::new(),\n            max_acp_stdout_bytes: None,\n            timeout_secs: None,\n            vision_enabled: false,\n        }\n    }\n\n    fn validate_working_directory(value: &str) -> anyhow::Result<PathBuf> {\n        let trimmed = value.trim();\n        if trimmed.is_empty() {\n            anyhow::bail!(\n                \"grok_cli requires an explicit working_directory for the ACP session boundary\"\n            );\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);","sourceCodeStart":469,"sourceCodeEnd":505,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-providers/src/grok_cli.rs#L469-L505","documentation":"grok_cli is ACP-backed and refuses to construct without an explicit working_directory: it defines the filesystem boundary of the ACP session, so unlike other providers no default or cwd fallback is guessed. validate_working_directory rejects empty/whitespace values with this bail.","triggerScenarios":"Building a GrokCliModelProvider without calling .working_directory(...) on the builder; a config entry whose working_directory is missing, empty, or whitespace.","commonSituations":"Config template copied without the field; assuming the daemon's cwd is used like other providers; YAML null coerced to empty string.","solutions":["Set working_directory to an existing absolute directory (typically the project root) on the builder or in config","Validate config presence at startup, not at first chat call"],"exampleFix":"// before\nlet provider = GrokCliModelProvider::builder(\"grok\").build()?;\n\n// after\nlet provider = GrokCliModelProvider::builder(\"grok\")\n    .working_directory(\"/home/user/project\")\n    .build()?;","handlingStrategy":"validation","validationCode":"fn working_directory_specified(v: &str) -> bool {\n    !v.trim().is_empty()\n}","typeGuard":"fn working_directory_specified(v: &str) -> bool { !v.trim().is_empty() }","tryCatchPattern":"if let Err(e) = GrokCliModelProvider::builder(\"grok\").build().check() {\n    if e.to_string().contains(\"explicit working_directory\") {\n        return Err(anyhow::anyhow!(\"set grok_cli working_directory in config\"));\n    }\n    return Err(e);\n}","preventionTips":["Make working_directory a required field in your provider config schema","Lint grok_cli entries at config load time","Document that grok_cli has no cwd fallback"],"tags":["rust","zeroclaw","grok-cli","acp","working-directory","configuration"],"backgroundTag":"missing-required-config","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}