phacility/phabricator · error · Exception
Mercurial repository has no new or old heads for branch
Error message
Mercurial repository has no new or old heads for branch "%s" after push. This makes no sense; rejecting change.
What it means
An invariant assertion in findMercurialChangegroupRefUpdates: after a push, a branch appears in neither the pre-push nor post-push head sets (both old_heads and new_heads are empty). The code comments say this 'should never be possible', so the error signals corrupted/unexpected Mercurial changegroup state rather than a user mistake; the push is rejected defensively.
Solutions
- Retry the push; transient Mercurial state or a race may be at fault
- Check the Mercurial server version for known push-key/head bugs
- Report the changegroup details upstream if it reproduces reliably
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at src/applications/diffusion/engine/DiffusionCommitHookEngine.php:807 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/da73d8ceb7abbd06.
Report an issue: GitHub.
Appendix: source
Thrown at src/applications/diffusion/engine/DiffusionCommitHookEngine.php:807
list($err, $old_raw) = $futures['old']->resolve();
$old_refs = $this->parseMercurialHeads($old_raw);
list($err, $new_raw) = $futures['new']->resolve();
$new_refs = $this->parseMercurialHeads($new_raw);
$all_refs = array_keys($old_refs + $new_refs);
$ref_updates = array();
foreach ($all_refs as $ref) {
$old_heads = idx($old_refs, $ref, array());
$new_heads = idx($new_refs, $ref, array());
sort($old_heads);
sort($new_heads);
if (!$old_heads && !$new_heads) {
// This should never be possible, as it makes no sense. Explode.
throw new Exception(
pht(
'Mercurial repository has no new or old heads for branch "%s" '.
'after push. This makes no sense; rejecting change.',
$ref));
}
if ($old_heads === $new_heads) {
// No changes to this branch, so skip it.
continue;
}
$stray_heads = array();
$head_map = array();
if ($old_heads && !$new_heads) {
// This is a branch deletion with "--close-branch".
foreach ($old_heads as $old_head) {
$head_map[$old_head] = array(self::EMPTY_HASH);View on GitHub (pinned to 5720a38cfe)