{"record":{"id":"1fa53f3fa07e367b","repo":"phacility/phabricator","slug":"unable-to-identify-parent-s","errorCode":null,"errorMessage":"Unable to identify parent \"%s\"!","messagePattern":"Unable to identify parent \"(.+?)\"!","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php","lineNumber":622,"sourceCode":"    try {\n      // If this commit has parents, look up their IDs. The parent commits\n      // should always exist already.\n\n      $parent_ids = array();\n      if ($parents) {\n        $parent_rows = queryfx_all(\n          $conn_w,\n          'SELECT id, commitIdentifier FROM %T\n            WHERE commitIdentifier IN (%Ls) AND repositoryID = %d',\n          $commit->getTableName(),\n          $parents,\n          $repository->getID());\n\n        $parent_map = ipull($parent_rows, 'id', 'commitIdentifier');\n\n        foreach ($parents as $parent) {\n          if (empty($parent_map[$parent])) {\n            throw new Exception(\n              pht('Unable to identify parent \"%s\"!', $parent));\n          }\n          $parent_ids[] = $parent_map[$parent];\n        }\n      } else {\n        // Write an explicit 0 so we can distinguish between \"really no\n        // parents\" and \"data not available\".\n        if (!$repository->isSVN()) {\n          $parent_ids = array(0);\n        }\n      }\n\n      $commit->openTransaction();\n        $commit->save();\n\n        $data->setCommitID($commit->getID());\n        $data->save();\n","sourceCodeStart":604,"sourceCodeEnd":640,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/repository/engine/PhabricatorRepositoryDiscoveryEngine.php#L604-L640","documentation":"Thrown during commit discovery while writing parent links: the engine read a commit's parent identifiers from the VCS, then queried the commit table for those identifiers under this repository ID, and at least one parent identifier had no row. Discovery normally walks history so parents are recorded before children; a missing parent row means history was walked out of order, the working copy is missing objects, or the commit rows belong to a different repository ID.","triggerScenarios":"History rewriting (rebase or filter-branch in git) changing parent chains between discovery runs; discovery racing against a mirror that is mid-sync and missing objects; a repository record reused after its commit rows were reset or partially lost; commits whose rows were assigned to another repositoryID.","commonSituations":"Force-pushed repositories where discovery sees a child before its new parents are recorded; restores from backup with partially lost commit rows; running discovery against an incomplete mirror.","solutions":["Re-run discovery with 'bin/repository discover <repository>'; transient ordering gaps usually self-heal on the next pass","Run 'bin/repository pull' first so the working copy has all objects, then discover again","If history was rewritten intentionally, remove stale commit rows or re-import the repository so recorded history matches the VCS","Inspect the commit table for the missing identifier and confirm its repositoryID matches this repository"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  id(new PhabricatorRepositoryDiscoveryEngine())\n    ->setRepository($repository)\n    ->discoverCommits();\n} catch (Exception $ex) {\n  if (preg_match('/Unable to identify parent/', $ex->getMessage())) {\n    // pull first so all objects exist, then rediscover next cycle\n    id(new PhabricatorRepositoryPullEngine())\n      ->setRepository($repository)\n      ->pullRepository();\n  }\n}","preventionTips":["Run 'bin/repository pull' before discovery on mirrors that may be mid-sync","Avoid rewriting published history that Phabricator has already imported","Monitor discovery task failures per repository so gaps are caught early"],"tags":["phabricator","discovery","git","commit-graph","data-integrity"],"backgroundTag":"missing-parent-commit","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}