{"record":{"id":"6008d53689505b2e","repo":"warpdotdev/warp","slug":"gh-auth-setup-git-failed-err","errorCode":null,"errorMessage":"gh auth setup-git failed: {err:?}","messagePattern":"gh auth setup-git failed: (.+?)","errorType":"exception","errorClass":"AgentDriverError","httpStatus":null,"severity":"error","filePath":"app/src/ai/agent_sdk/mod.rs","lineNumber":875,"sourceCode":"        ai_client\n            .get_task_git_credentials(task_id_str, workload_token)\n            .await\n    }\n\n    async fn bootstrap_git_credentials_for_task(\n        foreground: &ModelSpawner<Self>,\n        task_id_str: &str,\n        args: &RunAgentArgs,\n    ) -> Result<(), AgentDriverError> {\n        if warp_isolation_platform::detect().is_none() && args.configure_git_credentials_with_github\n        {\n            foreground\n                .spawn(|_, _| {\n                    command::blocking::Command::new(\"gh\")\n                        .args([\"auth\", \"setup-git\"])\n                        .spawn()\n                        .map_err(|err| {\n                            AgentDriverError::ConfigBuildFailed(anyhow::anyhow!(\n                                \"gh auth setup-git failed: {err:?}\"\n                            ))\n                        })\n                })\n                .await?\n                .map(|_| ())?;\n            return Ok(());\n        }\n\n        if !FeatureFlag::GitCredentialRefresh.is_enabled() {\n            return Ok(());\n        }\n\n        if task_id_str.parse::<AmbientAgentTaskId>().is_err() {\n            log::debug!(\n                \"Skipping git credentials bootstrap: could not parse task ID '{task_id_str}'\"\n            );\n            return Ok(());","sourceCodeStart":857,"sourceCodeEnd":893,"githubUrl":"https://github.com/warpdotdev/warp/blob/e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc/app/src/ai/agent_sdk/mod.rs#L857-L893","documentation":"During agent credential setup, when the run is not inside an isolation platform and `--configure-git-credentials-with-github` is set, the SDK spawns `gh auth setup-git` via a blocking Command. This error means the `gh` process itself could not be spawned (binary missing, not on the warp process's PATH, or exec permission denied) — it is a spawn failure, not gh returning a non-zero status. It is wrapped in AgentDriverError::ConfigBuildFailed.","triggerScenarios":"Running with `--configure-git-credentials-with-github` (or the config equivalent) on a machine without the GitHub CLI installed, with gh not on the PATH inherited by the warp process, or in hardened environments where subprocess spawn is restricted.","commonSituations":"Fresh CI containers without gh installed; PATH differences between an interactive shell and the environment warp was launched from (launchers, systemd services, cron); minimal agent sandbox images.","solutions":["Install the GitHub CLI (brew install gh / apt install gh) and confirm `gh --version` works in the same environment warp runs in","Run `gh auth login` once so setup-git has credentials to configure","If git credential injection is not needed, drop the `--configure-git-credentials-with-github` flag","In CI, bake gh into the image and ensure PATH is inherited by the warp process"],"exampleFix":"# before (CI step without gh in the image)\nwarp agent run --configure-git-credentials-with-github 'clone and test'\n\n# after (Dockerfile)\nRUN apt-get update && apt-get install -y gh\n# then the same run command succeeds","handlingStrategy":"validation","validationCode":"# Preflight: gh must exist and be authenticated before enabling the flag\nif command -v gh >/dev/null 2>&1 && gh auth status >/dev/null 2>&1; then\n  warp agent run --configure-git-credentials-with-github \"$TASK\"\nelse\n  echo 'gh missing or unauthenticated; running without credential setup' >&2\n  warp agent run \"$TASK\"\nfi","typeGuard":null,"tryCatchPattern":"out=$(warp agent run --configure-git-credentials-with-github \"$TASK\" 2>&1) || { case \"$out\" in *'gh auth setup-git failed'*) echo 'install/authorize gh, then retry' >&2; exit 1;; *) echo \"$out\" >&2; exit 1;; esac; }","preventionTips":["Bake gh into CI images and run gh auth login during setup","Only pass --configure-git-credentials-with-github when a preflight `command -v gh` succeeds","Remember PATH seen by cron/systemd/launchers differs from your shell"],"tags":["git","github-cli","subprocess","agent-sdk"],"backgroundTag":null,"analyzedSha":"e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc","analyzedAt":"2026-08-16T08:27:25.381Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}