nodejs/node · error · GitFailedException

'git %s' failed.

Error message

'git %s' failed.

What it means

Git() wraps the side_effect_handler.Command in Retry and expects a non-None result. If the underlying call returns None/falsy after retries, Git raises GitFailedException formatted with the git args string. The real git stderr was already printed by the side effect handler.

Source

Thrown at deps/v8/tools/release/common_includes.py:406

  def ReadLine(self, default=None):
    # Don't prompt in forced mode.
    if self._options.force_readline_defaults and default is not None:
      print("%s (forced)" % default)
      return default
    else:
      return self._side_effect_handler.ReadLine()

  def Command(self, name, args, cwd=None):
    cmd = lambda: self._side_effect_handler.Command(
        name, args, "", True, cwd=cwd or self.default_cwd)
    return self.Retry(cmd, None, [5])

  def Git(self, args="", prefix="", pipe=True, retry_on=None, cwd=None):
    cmd = lambda: self._side_effect_handler.Command(
        "git", args, prefix, pipe, cwd=cwd or self.default_cwd)
    result = self.Retry(cmd, retry_on, [5, 30])
    if result is None:
      raise GitFailedException("'git %s' failed." % args)
    return result

  def Editor(self, args):
    if self._options.requires_editor:
      return self._side_effect_handler.Command(
          os.environ["EDITOR"],
          args,
          pipe=False,
          cwd=self.default_cwd)

  def ReadURL(self, url, params=None, retry_on=None, wait_plan=None):
    wait_plan = wait_plan or [3, 60, 600]
    cmd = lambda: self._side_effect_handler.ReadURL(url, params)
    return self.Retry(cmd, retry_on, wait_plan)

  def Die(self, msg=""):
    if msg != "":
      print("Error: %s" % msg)

View on GitHub (pinned to 1b2de5e052)

Solutions

  1. Run the same `git <args>` manually in the repo (default_cwd) to see the real error.
  2. Verify the referenced refs/branches/remotes exist.
  3. Run `git fsck` / re-clone if the repo is corrupt.
  4. Check credentials/SSH for private remotes.
Defensive patterns

Strategy: try-catch

Validate before calling

# Pre-flight: confirm the refs the script will touch exist locally.
import subprocess
subprocess.run(['git', 'rev-parse', '--verify', ref], check=True, cwd=repo)

Try / catch

try:
    out = self.Git(args)
except GitFailedException as e:
    log.error('git %s failed: %s', args, e)
    raise

Prevention

When it happens

Trigger: Any self.Git(...) call where the underlying git command fails to produce a result after retries.

Common situations: Bad ref/branch/tag name; auth/SSH failure on a private remote; missing remote; corrupt repo; network blip longer than the retry window.

Related errors


AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13). Data as JSON: /api/errors/7efb13dedaf39c42. Report an issue: GitHub.