phacility/phabricator · error · Exception

Failed to reload object identified by monogram "%s" when que

Error message

Failed to reload object identified by monogram "%s" when querying by PHID.

What it means

After a monogram resolves to an object of the correct class, the edit engine reloads it by PHID through its own standard query (with need* clauses and policy checks). This exception means that second, authoritative load unexpectedly returned nothing even though the name lookup just succeeded.

Source

Thrown at src/applications/transactions/editengine/PhabricatorEditEngine.php:772

    $target_class = get_class($target);
    if ($expect_class !== $target_class) {
      throw new Exception(
        pht(
          'Monogram "%s" identifies an object of the wrong type. Loaded '.
          'object has class "%s", but this editor operates on objects of '.
          'type "%s".',
          $identifier,
          $target_class,
          $expect_class));
    }

    // Load the object by PHID using this engine's standard query. This makes
    // sure it's really valid, goes through standard policy check logic, and
    // picks up any `need...()` clauses we want it to load with.

    $object = $this->newObjectFromPHID($target->getPHID(), $capabilities);
    if (!$object) {
      throw new Exception(
        pht(
          'Failed to reload object identified by monogram "%s" when '.
          'querying by PHID.',
          $identifier));
    }

    return $object;
  }

  /**
   * Load an object by ID.
   *
   * @param int Object ID.
   * @param list<const> List of required capability constants, or omit for
   *   defaults.
   * @return object|null Object, or null if no such object exists.
   * @task load
   */

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Re-check the object still exists and is editable, then retry the edit once
  2. If it recurs deterministically for one object, compare the viewer's view vs edit policy on it and loosen policy or use a privileged viewer
  3. Serialize bulk edits so a delete/lock cannot interleave with a reload
  4. Treat persistent occurrences as a data/policy anomaly on that specific object and inspect it manually

Example fix

// before: single attempt that can lose the race
$result = $client->callMethod('maniphest.edit', $parameters);

// after: re-validate and retry once on this specific failure
try {
  $result = $client->callMethod('maniphest.edit', $parameters);
} catch (ConduitClientException $ex) {
  if (strpos($ex->getMessage(), 'Failed to reload object') === false) {
    throw $ex;
  }
  $still = $client->callMethod('maniphest.search', array(
    'constraints' => array('phids' => array($phid)),
  ));
  if ($still['data']) {
    $result = $client->callMethod('maniphest.edit', $parameters); // retry once
  }
}
Defensive patterns

Strategy: retry

Validate before calling

// Before retrying, confirm the object still exists for this viewer:
$still = $client->callMethod('maniphest.search', array(
  'constraints' => array('phids' => array($phid)),
));
if (empty($still['data'])) {
  // genuinely gone now; give up cleanly
}

Try / catch

try {
  $result = $client->callMethod('maniphest.edit', $parameters);
} catch (ConduitClientException $ex) {
  if (strpos($ex->getMessage(), 'Failed to reload object') !== false) {
    // transient race: re-check existence, then retry exactly once
  } else {
    throw $ex;
  }
}

Prevention

When it happens

Trigger: The object is deleted or policy-changed between the withNames() resolution and the newObjectFromPHID() reload (a narrow race); an exotic policy/flag combination where the generic name query can see an object the engine's own required-capability query cannot.

Common situations: Concurrent automation where one process deletes or locks the object mid-edit; objects whose edit policy was just restricted; very rare in practice — most users hit this during high-concurrency bulk editing.

Related errors


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