phacility/phabricator · error · PhutilArgumentUsageException

Some specified messages do not exist: %s

Error message

Some specified messages do not exist: %s

What it means

resend loaded rows for the requested IDs via PhabricatorMetaMTAMail->loadAllWhere('id IN (%Ld)', $ids) and compared: array_diff_key found requested IDs with no matching row. It refuses to resend a partial set and lists exactly which IDs do not exist - they are typos, IDs from another install, or mail rows removed by retention/garbage collection.

Source

Thrown at src/applications/metamta/management/PhabricatorMailManagementResendWorkflow.php:42

    $console = PhutilConsole::getConsole();

    $ids = $args->getArg('id');
    if (!$ids) {
      throw new PhutilArgumentUsageException(
        pht(
          "Use the '%s' flag to specify one or more messages to resend.",
          '--id'));
    }

    $messages = id(new PhabricatorMetaMTAMail())->loadAllWhere(
      'id IN (%Ld)',
      $ids);

    if ($ids) {
      $ids = array_fuse($ids);
      $missing = array_diff_key($ids, $messages);
      if ($missing) {
        throw new PhutilArgumentUsageException(
          pht(
            'Some specified messages do not exist: %s',
            implode(', ', array_keys($missing))));
      }
    }

    foreach ($messages as $message) {
      $message->setStatus(PhabricatorMailOutboundStatus::STATUS_QUEUE);
      $message->save();

      $mailer_task = PhabricatorWorker::scheduleTask(
        'PhabricatorMetaMTAWorker',
        $message->getID(),
        array(
          'priority' => PhabricatorWorker::PRIORITY_ALERTS,
        ));

      $console->writeOut(

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Drop the listed missing IDs from the command and resend only the ones that exist - the error message enumerates them precisely.
  2. Verify each ID in the Outbound Mail UI before resending.
  3. If the mail was garbage-collected, resend is impossible - re-generate the notification instead (e.g. trigger the sending action again).

Example fix

# before: 34 does not exist
./bin/mail resend --id 12 --id 34

# after: resend only existing IDs
./bin/mail resend --id 12
Defensive patterns

Strategy: validation

Validate before calling

// Verify all IDs exist before invoking resend.
$messages = id(new PhabricatorMetaMTAMail())->loadAllWhere(
  'id IN (%Ld)',
  $ids);
$missing = array_diff($ids, mpull($messages, 'getID'));
if ($missing) {
  // drop or abort before calling ./bin/mail resend
}

Prevention

When it happens

Trigger: Passing --id with a typo'd or nonexistent mail ID; copy-pasting IDs between environments (dev vs prod); the mail was old enough that the outbound mail table was pruned by GC; a race where the row was deleted between listing and resending.

Common situations: Scripted resends fed from stale lists; installs with aggressive mail retention; cross-environment ID confusion.

Related errors


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