{"record":{"id":"b8f8e411eaa335be","repo":"phacility/phabricator","slug":"commit-s-is-not-a-reachable-ancestor-of-any-ref","errorCode":null,"errorMessage":"Commit \"%s\" is not a reachable ancestor of any ref.","messagePattern":"Commit \"(.+?)\" is not a reachable ancestor of any ref\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/repository/daemon/PhabricatorGitGraphStream.php","lineNumber":94,"sourceCode":"        $parents = array();\n      }\n\n      $this->dates[$hash] = $epoch;\n      $this->parents[$hash] = $parents;\n\n      if ($this->isParsed($commit)) {\n        return;\n      }\n    }\n\n    if ($this->startCommit !== null) {\n      throw new Exception(\n        pht(\n          'Commit \"%s\" is not a reachable ancestor of \"%s\".',\n          $commit,\n          $this->startCommit));\n    } else {\n      throw new Exception(\n        pht(\n          'Commit \"%s\" is not a reachable ancestor of any ref.',\n          $commit));\n    }\n  }\n\n  private function isParsed($commit) {\n    return isset($this->dates[$commit]);\n  }\n\n}\n","sourceCodeStart":76,"sourceCodeEnd":106,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/repository/daemon/PhabricatorGitGraphStream.php#L76-L106","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Confirm reachability: git branch -a --contains <commit> and git tag --contains <commit> in the mirror; empty output means no ref reaches it.","Update or re-clone the mirror so refs include the commit (full clone, not shallow).","If the commit was legitimately orphaned upstream, let garbage collection drop stale references in Phabricator's database instead of asking the stream for them.","Check for misconfigured refspecs/pull policies that skip the ref containing the commit."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Precheck reachability from any ref:\n// git branch -a --contains <commit>; git tag --contains <commit>\n// empty output means the stream will throw.","typeGuard":"function isCommitReachableFromAnyRef($repository_path, $commit) {\n  list($out) = execx('git -C %s branch -a --contains %s', $repository_path, $commit);\n  return trim($out) !== '';\n}","tryCatchPattern":"try {\n  $date = $stream->getCommitDate($commit);\n} catch (Exception $ex) {\n  phlog($ex);\n  // treat as orphaned: drop stale references or repair mirror, then retry\n  $this->yieldToDaemon();\n}","preventionTips":["Do not query graph data for hashes that predate a history rewrite.","Ensure refspecs/pull policies cover all branches and tags that matter.","Run gc periodically on mirrors and let old, unreachable commits expire from tracking."],"tags":["php","phabricator","git","repository-daemon","dangling-commit"],"backgroundTag":"unreachable-commit","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}