phacility/phabricator · error · Exception

Commit "%s" is not a reachable ancestor of any ref.

Error message

Commit "%s" is not a reachable ancestor of any ref.

What it means

Exception from PhabricatorGitGraphStream: with no start commit set, the stream walked every ref's history via git log and never encountered the requested commit. The commit exists from the caller's perspective but is not reachable from any ref in the mirror, so the stream cannot assign it a date or parents.

Source

Thrown at src/applications/repository/daemon/PhabricatorGitGraphStream.php:94

        $parents = array();
      }

      $this->dates[$hash] = $epoch;
      $this->parents[$hash] = $parents;

      if ($this->isParsed($commit)) {
        return;
      }
    }

    if ($this->startCommit !== null) {
      throw new Exception(
        pht(
          'Commit "%s" is not a reachable ancestor of "%s".',
          $commit,
          $this->startCommit));
    } else {
      throw new Exception(
        pht(
          'Commit "%s" is not a reachable ancestor of any ref.',
          $commit));
    }
  }

  private function isParsed($commit) {
    return isset($this->dates[$commit]);
  }

}

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Confirm reachability: git branch -a --contains <commit> and git tag --contains <commit> in the mirror; empty output means no ref reaches it.
  2. Update or re-clone the mirror so refs include the commit (full clone, not shallow).
  3. If the commit was legitimately orphaned upstream, let garbage collection drop stale references in Phabricator's database instead of asking the stream for them.
  4. Check for misconfigured refspecs/pull policies that skip the ref containing the commit.
Defensive patterns

Strategy: try-catch

Validate before calling

// Precheck reachability from any ref:
// git branch -a --contains <commit>; git tag --contains <commit>
// empty output means the stream will throw.

Type guard

function isCommitReachableFromAnyRef($repository_path, $commit) {
  list($out) = execx('git -C %s branch -a --contains %s', $repository_path, $commit);
  return trim($out) !== '';
}

Try / catch

try {
  $date = $stream->getCommitDate($commit);
} catch (Exception $ex) {
  phlog($ex);
  // treat as orphaned: drop stale references or repair mirror, then retry
  $this->yieldToDaemon();
}

Prevention

When it happens

Trigger: Requesting date/parent data for a commit that is not an ancestor of any branch or tag: a dangling commit after a force push or branch deletion, a hash from a different repository or an old clone, or a commit only reachable from refs git log was not asked to walk (e.g. hidden/namespaced refs).

Common situations: Branch deletion or force-push upstream orphaned commits the daemon still references; a commit discovery race where the ref moved before the graph query; shallow clones missing intermediate history; processing imported hashes from another repo after a misconfigured mirror.

Related errors


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/b8f8e411eaa335be. Report an issue: GitHub.