warpdotdev/warp · error · AgentDriverError

gh auth setup-git failed: {err:?}

Error message

gh auth setup-git failed: {err:?}

What it means

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.

Source

Thrown at app/src/ai/agent_sdk/mod.rs:875

        ai_client
            .get_task_git_credentials(task_id_str, workload_token)
            .await
    }

    async fn bootstrap_git_credentials_for_task(
        foreground: &ModelSpawner<Self>,
        task_id_str: &str,
        args: &RunAgentArgs,
    ) -> Result<(), AgentDriverError> {
        if warp_isolation_platform::detect().is_none() && args.configure_git_credentials_with_github
        {
            foreground
                .spawn(|_, _| {
                    command::blocking::Command::new("gh")
                        .args(["auth", "setup-git"])
                        .spawn()
                        .map_err(|err| {
                            AgentDriverError::ConfigBuildFailed(anyhow::anyhow!(
                                "gh auth setup-git failed: {err:?}"
                            ))
                        })
                })
                .await?
                .map(|_| ())?;
            return Ok(());
        }

        if !FeatureFlag::GitCredentialRefresh.is_enabled() {
            return Ok(());
        }

        if task_id_str.parse::<AmbientAgentTaskId>().is_err() {
            log::debug!(
                "Skipping git credentials bootstrap: could not parse task ID '{task_id_str}'"
            );
            return Ok(());

View on GitHub (pinned to e72fd7aacb)

Solutions

  1. Install the GitHub CLI (brew install gh / apt install gh) and confirm `gh --version` works in the same environment warp runs in
  2. Run `gh auth login` once so setup-git has credentials to configure
  3. If git credential injection is not needed, drop the `--configure-git-credentials-with-github` flag
  4. In CI, bake gh into the image and ensure PATH is inherited by the warp process

Example fix

# before (CI step without gh in the image)
warp agent run --configure-git-credentials-with-github 'clone and test'

# after (Dockerfile)
RUN apt-get update && apt-get install -y gh
# then the same run command succeeds
Defensive patterns

Strategy: validation

Validate before calling

# Preflight: gh must exist and be authenticated before enabling the flag
if command -v gh >/dev/null 2>&1 && gh auth status >/dev/null 2>&1; then
  warp agent run --configure-git-credentials-with-github "$TASK"
else
  echo 'gh missing or unauthenticated; running without credential setup' >&2
  warp agent run "$TASK"
fi

Try / catch

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; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of warpdotdev/warp@e72fd7aacb (2026-08-16). Data as JSON: /api/errors/6008d53689505b2e. Report an issue: GitHub.