phacility/phabricator · error · PhabricatorWorkerPermanentFailureException

Commit "%s" does not exist.

Error message

Commit "%s" does not exist.

What it means

The parser worker resolved a commitPHID from the task payload, but DiffusionCommitQuery->withPHIDs(...)->executeOne() returns nothing (PhabricatorRepositoryCommitParserWorker.php:42-48). The commit row does not exist (or never did), so the task is permanently failed and will not be retried.

Source

Thrown at src/applications/repository/worker/PhabricatorRepositoryCommitParserWorker.php:46

        $legacy_commit = id(clone $commit_query)
          ->withIDs(array($commit_id))
          ->executeOne();
        if ($legacy_commit) {
          $commit_phid = $legacy_commit->getPHID();
        }
      }
    }

    if (!$commit_phid) {
      throw new PhabricatorWorkerPermanentFailureException(
        pht('Task data has no "commitPHID".'));
    }

    $commit = id(clone $commit_query)
      ->withPHIDs(array($commit_phid))
      ->executeOne();
    if (!$commit) {
      throw new PhabricatorWorkerPermanentFailureException(
        pht('Commit "%s" does not exist.', $commit_phid));
    }

    if ($commit->isUnreachable()) {
      throw new PhabricatorWorkerPermanentFailureException(
        pht(
          'Commit "%s" (with PHID "%s") is no longer reachable from any '.
          'branch, tag, or ref in this repository, so it will not be '.
          'imported. This usually means that the branch the commit was on '.
          'was deleted or overwritten.',
          $commit->getMonogram(),
          $commit_phid));
    }

    $this->commit = $commit;

    return $commit;
  }

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Confirm the commit is really gone: query repository_commit by PHID and check whether the repository itself still exists
  2. If the repository was deleted intentionally, let the task expire - the permanent failure is correct
  3. If the row should exist, restore it or re-run discovery (bin/repository discover) to recreate commits, then bin/repository reparse for the affected commits
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the commit is loadable before scheduling follow-up work.
$exists = id(new DiffusionCommitQuery())
  ->setViewer(PhabricatorUser::getOmnipotentUser())
  ->withPHIDs(array($commit_phid))
  ->executeOne();
if (!$exists) {
  // skip scheduling; the row is gone
}

Type guard

function commitExists($commit_phid) {
  return (bool)id(new DiffusionCommitQuery())
    ->setViewer(PhabricatorUser::getOmnipotentUser())
    ->withPHIDs(array($commit_phid))
    ->executeOne();
}

Try / catch

try {
  $commit = $worker->loadCommit();
} catch (PhabricatorWorkerPermanentFailureException $ex) {
  // Row deleted (e.g., repository removal): archive the task; retrying
  // cannot succeed until the commit is recreated.
  phlog($ex);
}

Prevention

When it happens

Trigger: The repository (and its commits) was deleted while parse tasks were still queued; commit rows were purged by external tooling or a partial DB restore; the task payload references a mistyped or fabricated PHID.

Common situations: Deleting a repository with a backlog of parse tasks (tasks outlive the repository until the queue drains); database restores that drop rows but keep the worker queue; hand-built task payloads.

Related errors


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