{"record":{"id":"330cbadbaaa5a816","repo":"xai-org/grok-build","slug":"git-fetch-no-tags-origin-spec-failed-status","errorCode":null,"errorMessage":"git fetch --no-tags origin {spec} failed ({status}): {stderr}","messagePattern":"git fetch --no-tags origin (.+?) failed \\((.+?)\\): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-workspace/src/restore_fetch.rs","lineNumber":401,"sourceCode":"        }\n        Ok(Self {\n            child: Some(child),\n            group,\n            stderr: Some(stderr),\n            abandoned: false,\n        })\n    }\n\n    fn wait_success(&mut self, timeout: Duration, spec: &str) -> Result<()> {\n        let child = self.child.as_mut().context(\"fetch child already reaped\")?;\n        match child.wait_timeout(timeout) {\n            Ok(Some(status)) => {\n                self.child.take();\n                let stderr = self.take_stderr();\n                if status.success() {\n                    Ok(())\n                } else {\n                    bail!(\"git fetch --no-tags origin {spec} failed ({status}): {stderr}\");\n                }\n            }\n            Ok(None) => {\n                let shutdown = self.shutdown();\n                let stderr = self.take_stderr();\n                bail!(\n                    \"git fetch --no-tags origin {spec} timed out after {}s{}{}\",\n                    timeout.as_secs(),\n                    format_shutdown_suffix(shutdown.as_ref()),\n                    format_stderr_suffix(&stderr)\n                );\n            }\n            Err(err) => {\n                let shutdown = self.shutdown();\n                let stderr = self.take_stderr();\n                Err(err).context(format!(\n                    \"waiting for git fetch origin {spec}{}{}\",\n                    format_shutdown_suffix(shutdown.as_ref()),","sourceCodeStart":383,"sourceCodeEnd":419,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-workspace/src/restore_fetch.rs#L383-L419","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the stderr suffix in the message and fix the underlying git failure (missing ref, auth, network)","Verify the ref/spec exists: git ls-remote origin <spec>","Confirm 'origin' remote is configured and credentials work: git fetch origin","Retry once connectivity is restored"],"exampleFix":"// before\nwaiter.wait_success(Duration::from_secs(60))?; // bails on unknown refspec\n// after\nif !ref_exists_on_remote(repo, spec) { ensure_remote_branch(repo, spec)?; }\nwaiter.wait_success(Duration::from_secs(60))?;","handlingStrategy":"try-catch","validationCode":"let out = std::process::Command::new(\"git\").args([\"ls-remote\",\"origin\",spec]).output()?;\nif !out.status.success() { anyhow::bail!(\"spec {} not reachable on origin: {}\", spec, String::from_utf8_lossy(&out.stderr)); }","typeGuard":"fn fetch_output_is_actionable(err: &str) -> bool { !err.contains(\"timed out\") }","tryCatchPattern":"match waiter.wait_success(timeout) {\n    Err(e) if e.to_string().contains(\"failed (\") => { /* inspect stderr in e, fix ref/auth, retry once */ }\n    other => other?,\n}","preventionTips":["Verify the refspec exists with git ls-remote before fetching","Ensure origin remote and credentials are configured non-interactively","Set GIT_TERMINAL_PROMPT=0 to fail fast instead of hanging","Pre-warm refs at workspace creation so later fetches are no-ops"],"tags":["git","fetch","network","subprocess"],"backgroundTag":"git-fetch-failed","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}