zed-industries/zed · error · RuntimeError

git merge-base --is-ancestor failed

Error message

git merge-base --is-ancestor failed

What it means

Error "git merge-base --is-ancestor failed" thrown in zed-industries/zed.

Source

Thrown at crates/eval_cli/zed_eval/source.py:119

    if not (commit_present(base_sha) and commit_present(main_sha)):
        subprocess.run(
            ["git", "-C", repo_root(), "fetch", "--quiet", repo_url, "main"],
            capture_output=True,
        )
    if not commit_present(main_sha):
        raise RuntimeError(
            f"origin/main tip {main_sha[:12]} unavailable locally after fetch"
        )
    if not commit_present(base_sha):
        # Not present even after pulling main's history -> not reachable from main.
        return False
    ancestry = subprocess.run(
        ["git", "-C", repo_root(), "merge-base", "--is-ancestor", base_sha, main_sha],
        capture_output=True,
    )
    if ancestry.returncode in (0, 1):
        return ancestry.returncode == 0
    raise RuntimeError(
        (ancestry.stderr or b"").decode(errors="replace").strip()
        or "git merge-base --is-ancestor failed"
    )


def resolve_git_ref(ref: str) -> str:
    return git_output(["rev-parse", "--verify", f"{ref}^{{commit}}"])


_FULL_SHA_RE = re.compile(r"[0-9a-fA-F]{40}")


def resolve_remote_ref(repo_url: str, ref: str) -> str:
    """Resolve a git ref/tag/branch/SHA to a canonical commit SHA against the
    *remote* repo, so the resulting build id is identical for every launcher
    regardless of what they happen to have fetched locally.

    A full 40-char SHA is already canonical and is returned (lowercased) without

View on GitHub (pinned to bc538def45)

When it happens

Trigger: Thrown at crates/eval_cli/zed_eval/source.py:119 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@bc538def45 (2026-08-16). Data as JSON: /api/errors/5da981b606bbfa33. Report an issue: GitHub.