xai-org/grok-build · error

git fetch --no-tags origin {spec} failed ({status}): {stderr

Error message

git fetch --no-tags origin {spec} failed ({status}): {stderr}

What it means

wait_success() on the streaming git fetch child completes with a non-zero exit status, so the wrapper bails with the spec, status, and captured stderr. It is the library's way of surfacing a real `git fetch --no-tags origin <spec>` failure instead of silently ignoring it.

Source

Thrown at crates/codegen/xai-grok-workspace/src/restore_fetch.rs:401

        }
        Ok(Self {
            child: Some(child),
            group,
            stderr: Some(stderr),
            abandoned: false,
        })
    }

    fn wait_success(&mut self, timeout: Duration, spec: &str) -> Result<()> {
        let child = self.child.as_mut().context("fetch child already reaped")?;
        match child.wait_timeout(timeout) {
            Ok(Some(status)) => {
                self.child.take();
                let stderr = self.take_stderr();
                if status.success() {
                    Ok(())
                } else {
                    bail!("git fetch --no-tags origin {spec} failed ({status}): {stderr}");
                }
            }
            Ok(None) => {
                let shutdown = self.shutdown();
                let stderr = self.take_stderr();
                bail!(
                    "git fetch --no-tags origin {spec} timed out after {}s{}{}",
                    timeout.as_secs(),
                    format_shutdown_suffix(shutdown.as_ref()),
                    format_stderr_suffix(&stderr)
                );
            }
            Err(err) => {
                let shutdown = self.shutdown();
                let stderr = self.take_stderr();
                Err(err).context(format!(
                    "waiting for git fetch origin {spec}{}{}",
                    format_shutdown_suffix(shutdown.as_ref()),

View on GitHub (pinned to bc7f02eddd)

Solutions

  1. Read the stderr suffix in the message and fix the underlying git failure (missing ref, auth, network)
  2. Verify the ref/spec exists: git ls-remote origin <spec>
  3. Confirm 'origin' remote is configured and credentials work: git fetch origin
  4. Retry once connectivity is restored

Example fix

// before
waiter.wait_success(Duration::from_secs(60))?; // bails on unknown refspec
// after
if !ref_exists_on_remote(repo, spec) { ensure_remote_branch(repo, spec)?; }
waiter.wait_success(Duration::from_secs(60))?;
Defensive patterns

Strategy: try-catch

Validate before calling

let out = std::process::Command::new("git").args(["ls-remote","origin",spec]).output()?;
if !out.status.success() { anyhow::bail!("spec {} not reachable on origin: {}", spec, String::from_utf8_lossy(&out.stderr)); }

Type guard

fn fetch_output_is_actionable(err: &str) -> bool { !err.contains("timed out") }

Try / catch

match waiter.wait_success(timeout) {
    Err(e) if e.to_string().contains("failed (") => { /* inspect stderr in e, fix ref/auth, retry once */ }
    other => other?,
}

Prevention

When it happens

Trigger: Calling wait_success() after spawning a fetch when the child exits unsuccessfully: unknown ref/branch spec, missing remote 'origin', network/auth failure, or refspec syntax error.

Common situations: Fetching a session branch that was force-deleted on the remote; offline CI runners; SSH credentials not available in the worktree environment; typo'd refspec.

Related errors


AI-assisted analysis of xai-org/grok-build@bc7f02eddd (2026-08-31). Data as JSON: /api/errors/330cbadbaaa5a816. Report an issue: GitHub.