{"record":{"id":"1d1716e2a4f8e1b8","repo":"phacility/phabricator","slug":"commit-s-has-not-been-discovered-yet-run-disco","errorCode":null,"errorMessage":"Commit \"%s\" has not been discovered yet! Run discovery before updating refs.","messagePattern":"Commit \"(.+?)\" has not been discovered yet! Run discovery before updating refs\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/repository/engine/PhabricatorRepositoryRefEngine.php","lineNumber":574,"sourceCode":"      // these records out in detail.\n\n      $commit_refs[] = id(new PhabricatorRepositoryCommitRef())\n        ->setIdentifier($identifier);\n    }\n\n    $task_priority = $this->getImportTaskPriority(\n      $repository,\n      $commit_refs);\n\n    $permanent_flag = PhabricatorRepositoryCommit::IMPORTED_PERMANENT;\n    $published_flag = PhabricatorRepositoryCommit::IMPORTED_PUBLISH;\n\n    $all_commits = ipull($all_commits, null, 'commitIdentifier');\n    foreach ($identifiers as $identifier) {\n      $row = idx($all_commits, $identifier);\n\n      if (!$row) {\n        throw new Exception(\n          pht(\n            'Commit \"%s\" has not been discovered yet! Run discovery before '.\n            'updating refs.',\n            $identifier));\n      }\n\n      $import_status = $row['importStatus'];\n      if (!($import_status & $permanent_flag)) {\n        // Set the \"permanent\" flag.\n        $import_status = ($import_status | $permanent_flag);\n\n        // See T13580. Clear the \"published\" flag, so publishing executes\n        // again. We may have previously performed a no-op \"publish\" on the\n        // commit to make sure it has all bits in the \"IMPORTED_ALL\" bitmask.\n        $import_status = ($import_status & ~$published_flag);\n\n        queryfx(\n          $conn,","sourceCodeStart":556,"sourceCodeEnd":592,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/repository/engine/PhabricatorRepositoryRefEngine.php#L556-L592","documentation":"Thrown by PhabricatorRepositoryRefEngine while updating ref cursors: the engine has identifiers of commits reachable from new ref positions, but one is absent from the already-discovered commit rows loaded for this repository. Ref updates require discovery to have run first; a missing row means refs moved ahead of discovery or the two raced, which would otherwise create cursors pointing at nonexistent commits.","triggerScenarios":"A ref update task executing before the discovery task for the same new commits (task scheduling race); discovery partially failed or was interrupted after refs were fetched; commits reachable from refs but excluded by an Import Only subpath; discovery stuck or errored earlier for this repository.","commonSituations":"Pushes arriving while discovery is behind on a large repo; daemons stopped mid-import; SVN repositories with subpath import where a ref points outside the imported subpath.","solutions":["Run discovery manually: 'bin/repository discover R123', then let the ref task retry or run 'bin/repository refs R123'","Check the task queue for a failed discovery task, fix its underlying error, and retry it with 'bin/worker retry <task-id>'","If using Import Only, make sure tracked refs do not point at commits outside the subpath, or widen the subpath","If it recurs steadily, look for an earlier discovery engine error in the logs for the same repository"],"exampleFix":"# before\nbin/repository refs R123   # throws: commit not discovered yet\n\n# after\nbin/repository discover R123\nbin/repository refs R123","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  id(new PhabricatorRepositoryRefEngine())\n    ->setRepository($repository)\n    ->updateRefs();\n} catch (Exception $ex) {\n  if (preg_match('/has not been discovered yet/', $ex->getMessage())) {\n    id(new PhabricatorRepositoryDiscoveryEngine())\n      ->setRepository($repository)\n      ->discoverCommits(); // then retry the ref update\n  }\n}","preventionTips":["Let discovery complete before manual ref updates: discover first, then refs","Watch for failed discovery tasks; ref errors are usually downstream symptoms","Scope Import Only subpaths to cover everything reachable from tracked refs"],"tags":["phabricator","repository","refs","discovery","task-ordering"],"backgroundTag":"commit-not-discovered","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}