phacility/phabricator · error · Exception

Mercurial repository has no new or old heads for branch "%s"

Error message

Mercurial repository has no new or old heads for branch "%s" after push. This makes no sense; rejecting change.

What it means

Error "Mercurial repository has no new or old heads for branch "%s" after push. This makes no sense; rejecting change." thrown in phacility/phabricator.

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)

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.