abhigyanpatwari/GitNexus · error · ValueError
could not resolve the committed promotion base
Error message
could not resolve the committed promotion base
What it means
Thrown in `committed_destination_base_digests` when `git rev-parse {ref}^{commit}` does not return a usable SHA. The guard requires `rev.ok`, no stdout overflow, and a non-None capture — any failure (bad ref, broken git, oversized output) is treated as 'cannot resolve the immutable base'.
Source
Thrown at eval/workflow_bench/promotion_apply.py:535
def committed_destination_base_digests(
overlay: Path,
repo_root: Path = REPO_ROOT,
*,
ref: str = "HEAD",
) -> dict[str, str]:
"""Bind targets to one immutable committed incumbent, never live edits."""
_, payload = candidate_overlay_payload(overlay)
root, root_descriptor = _open_repository_root(repo_root)
os.close(root_descriptor)
rev = run_managed(
["git", "-C", str(root), "rev-parse", f"{ref}^{{commit}}"],
timeout=60,
capture_stdout_bytes=256,
)
if not rev.ok or rev.stdout_capture_overflow or rev.stdout_capture is None:
raise ValueError("could not resolve the committed promotion base")
commit = rev.stdout_capture.decode("ascii", errors="strict").strip()
if not commit or any(character not in "0123456789abcdefABCDEF" for character in commit):
raise ValueError("committed promotion base is not an immutable object id")
bindings: dict[str, str] = {}
for relative, _content in payload:
for target in mirror_targets(relative):
key = target.as_posix()
if key in bindings:
raise ValueError(f"duplicate overlay destination: {target}")
result = run_managed(
["git", "-C", str(root), "show", f"{commit}:{key}"],
timeout=60,
capture_stdout_bytes=MAX_CANDIDATE_OVERLAY_BYTES + 1,
)
if not result.ok or result.stdout_capture_overflow or result.stdout_capture is None:
raise ValueError(f"committed overlay destination is unavailable: {target}")
bindings[key] = hashlib.sha256(result.stdout_capture).hexdigest()
return bindingsView on GitHub (pinned to d540b00184)
Solutions
- Verify the ref resolves: `git -C <repo> rev-parse '<ref>^{commit}'` in a shell — if it errors, fetch or use a valid ref.
- Ensure the repo has at least one commit (not an empty HEAD) and that the ref exists locally, not just on a remote.
- Confirm `git` is on PATH and `run_managed` can spawn it (no timeout, exit code 0).
- If the ref is a remote, run `git fetch <remote> <ref>` first, or pass `ref='FETCH_HEAD'`.
Example fix
# before bases = committed_destination_base_digests(overlay, ref='origin/main') # ref missing # after import subprocess subprocess.run(['git', '-C', str(repo_root), 'fetch', 'origin', 'main'], check=True) bases = committed_destination_base_digests(overlay, ref='origin/main')
Defensive patterns
Strategy: validation
Validate before calling
import subprocess
def ref_resolves_to_commit(repo_root, ref: str) -> bool:
"""True iff `git rev-parse <ref>^{commit}` exits 0 with a short stdout."""
try:
out = subprocess.run(
["git", "-C", str(repo_root), "rev-parse", f"{ref}^{{commit}}"],
check=True, capture_output=True, timeout=10,
)
except (subprocess.CalledProcessError, subprocess.TimeoutExpired):
return False
return bool(out.stdout.strip()) Type guard
null
Try / catch
null
Prevention
- Resolve the ref to a SHA in your own code, then pass that SHA as `ref`.
- Fetch the remote ref before capturing committed bases (`git fetch <remote> <ref>`).
- Never call `committed_destination_base_digests` on an empty repo or an un-fetched remote ref.
When it happens
Trigger: Calling `committed_destination_base_digests(overlay, ref=<ref>)` where `<ref>` does not exist in the repo, the repo has no commits, `git` is not on PATH, the `run_managed` subprocess timed out, or rev-parse printed more than 256 bytes (capture_overflow).
Common situations: Passing `ref='origin/main'` before fetching; running on a fresh worktree with detached HEAD pointing at a non-commit; ref was a remote-tracking branch that got pruned; CI checked out a shallow clone missing the ref; the default `ref='HEAD'` on an empty repo.
Related errors
- committed promotion base is not an immutable object id
- committed overlay destination is unavailable: {target}
- ${source}: branch name must not be empty.
- ${source}: branch name is too long (max ${BRANCH_MAX_LENGTH}
- ${source}: branch name must not contain whitespace.
AI-assisted analysis of abhigyanpatwari/GitNexus@d540b00184 (2026-08-12).
Data as JSON: /api/errors/a728dbd47e5dbfb2.
Report an issue: GitHub.