phacility/phabricator · error · PhabricatorWorkerPermanentFailureException

Task data has no "commitPHID".

Error message

Task data has no "commitPHID".

What it means

PhabricatorRepositoryCommitParserWorker::loadCommit() reads the worker task payload: modern tasks carry 'commitPHID', and a legacy fallback (T13591) resolves 'commitID' to a PHID (PhabricatorRepositoryCommitParserWorker.php:20-40). If neither key yields a PHID, the task is permanently failed because the payload can never succeed.

Source

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

    $commit_phid = idx($task_data, 'commitPHID');

    // TODO: See T13591. This supports execution of legacy tasks and can
    // eventually be removed. Newer tasks use "commitPHID" instead of
    // "commitID".
    if (!$commit_phid) {
      $commit_id = idx($task_data, 'commitID');
      if ($commit_id) {
        $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.',

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Inspect the failed task payload in the worker logs to see which keys it actually carries
  2. Re-queue with correct data: array('commitPHID' => $commit->getPHID()), or use bin/repository reparse which constructs tasks correctly
  3. If a legacy commitID cannot resolve because the commit row is gone, let the task expire - permanent failure is the intended outcome

Example fix

// before
PhabricatorWorker::scheduleTask(
  'PhabricatorRepositoryCommitParserWorker',
  array('commit' => $commit_identifier));

// after
PhabricatorWorker::scheduleTask(
  'PhabricatorRepositoryCommitParserWorker',
  array('commitPHID' => $commit->getPHID()));
Defensive patterns

Strategy: validation

Validate before calling

// Validate payload shape before scheduling a parser task.
$task_data = array('commitPHID' => $commit->getPHID());
if (!idx($task_data, 'commitPHID') && !idx($task_data, 'commitID')) {
  throw new Exception('Refusing to queue a parser task without commitPHID.');
}
PhabricatorWorker::scheduleTask(
  'PhabricatorRepositoryCommitParserWorker',
  $task_data);

Type guard

function hasValidParserPayload(array $task_data) {
  return isset($task_data['commitPHID'])
    || isset($task_data['commitID']);
}

Try / catch

try {
  $worker = new PhabricatorRepositoryCommitParserWorker($task_data);
  $commit = $worker->loadCommit();
} catch (PhabricatorWorkerPermanentFailureException $ex) {
  // Malformed payload: log and drop; never retry - it cannot succeed.
  phlog($ex);
}

Prevention

When it happens

Trigger: Scheduling PhabricatorRepositoryCommitParserWorker (or its change/message parser subclasses) with task data containing neither 'commitPHID' nor a resolvable 'commitID'; draining ancient pre-migration tasks whose commitID rows no longer exist.

Common situations: Custom scripts or extensions enqueueing parser tasks with wrong payload keys; long-lived task queues surviving Phabricator upgrades; manually re-queued archived tasks whose data was stripped or edited.

Related errors


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