phacility/phabricator · error · Exception

No such object "%s"!

Error message

No such object "%s"!

What it means

validateObject() in the token editor verifies the target object PHID with a PhabricatorObjectQuery scoped to the acting user. A failed load means the PHID does not exist or is not visible to the actor, so a token cannot be given for it.

Source

Thrown at src/applications/tokens/editor/PhabricatorTokenGivenEditor.php:166

      ->setViewer($this->requireActor())
      ->withPHIDs(array($token_phid))
      ->executeOne();

    if (!$token) {
      throw new Exception(pht('No such token "%s"!', $token_phid));
    }

    return $token;
  }

  private function validateObject($object_phid) {
    $object = id(new PhabricatorObjectQuery())
      ->setViewer($this->requireActor())
      ->withPHIDs(array($object_phid))
      ->executeOne();

    if (!$object) {
      throw new Exception(pht('No such object "%s"!', $object_phid));
    }

    return $object;
  }

  private function loadCurrentToken(PhabricatorTokenReceiverInterface $object) {
    return id(new PhabricatorTokenGiven())->loadOneWhere(
      'authorPHID = %s AND objectPHID = %s',
      $this->requireActor()->getPHID(),
      $object->getPHID());
  }


  private function publishTransaction(
    PhabricatorTokenReceiverInterface $object,
    $old_token_phid,
    $new_token_phid) {

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Verify the PHID resolves for the acting user before awarding the token
  2. Refresh the object reference on the client and retry with the current PHID
  3. Run as a viewer who can see the object if policies are the cause

Example fix

// before: awarding with a stale object PHID
$editor->giveTokenTo('PHID-TASK-gone', $token_phid);

// after: verify the target resolves first
$object = id(new PhabricatorObjectQuery())
  ->setViewer($actor)
  ->withPHIDs(array($object_phid))
  ->executeOne();
if ($object) {
  $editor->giveTokenTo($object->getPHID(), $token_phid);
}
Defensive patterns

Strategy: validation

Validate before calling

$object = id(new PhabricatorObjectQuery())
  ->setViewer($actor)
  ->withPHIDs(array($object_phid))
  ->executeOne();
if (!$object) {
  // stale or invisible target; refresh the reference instead of giving a token
}

Try / catch

Catch Exception from the editor, verify the target PHID with PhabricatorObjectQuery as the acting viewer, and only retry when the object resolves.

Prevention

When it happens

Trigger: Giving a token to a PHID that is deleted, malformed, or hidden from the acting user by view policies.

Common situations: Pages or clients holding references to deleted objects; automated reaction clients posting old PHIDs; policy changes that revoked visibility of the target.

Related errors


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