xai-org/grok-build · error · anyhow::Error

git fetch --no-tags origin {spec} timed out after {}s{}{}

Error message

git fetch --no-tags origin {spec} timed out after {}s{}{}

What it means

Same timeout bail site as the fetch timeout: message text is the timed-out `git fetch --no-tags origin <spec>` failure produced in wait_success()'s Ok(None) arm, including the timeout seconds, shutdown suffix, and stderr suffix.

Source

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

        })
    }

    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()),
                    format_stderr_suffix(&stderr)
                ))
            }
        }
    }

View on GitHub (pinned to bc7f02eddd)

Solutions

  1. Raise the wait_success() timeout budget
  2. Ensure credentials are non-interactive so git cannot block on a prompt
  3. Inspect format_stderr_suffix output for transfer errors
  4. Split the fetch into smaller refspecs to reduce transfer time

Example fix

// before
bail-budget = Duration::from_secs(60);
// after
bail-budget = Duration::from_secs(300); // with GIT_TERMINAL_PROMPT=0 set in env
Defensive patterns

Strategy: retry

Validate before calling

// ensure environment is non-interactive before spawning
std::env::set_var("GIT_TERMINAL_PROMPT", "0");

Type guard

fn is_fetch_timeout(err: &anyhow::Error) -> bool { err.to_string().contains("timed out after") }

Try / catch

let res = waiter.wait_success(timeout).await;
if let Err(e) = &res {
    if e.to_string().contains("timed out after") {
        // shutdown suffix present: child was killed; retry with larger budget and backoff
    }
}

Prevention

When it happens

Trigger: wait_success() poll deadline expires before the fetch child exits — the poll loop returns Ok(None) and shutdown() is invoked.

Common situations: Long initial clone-equivalent fetch in CI with tight step timeouts; remote hanging mid-transfer; hung credential helper.

Understand the failure class

Related errors


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