phacility/phabricator · error · PhutilArgumentUsageException

Unable to load specified object ("%s").

Error message

Unable to load specified object ("%s").

What it means

PhutilArgumentUsageException thrown by HeraldTestManagementWorkflow when the --object value does not resolve through PhabricatorObjectQuery::withNames() — i.e. no object with that monogram/name is loadable. The workflow then has nothing to build test adapters against, so it aborts. withNames() accepts monograms (T123, D456, P78...) and other object names, but the object must exist and be visible to the script's viewer.

Source

Thrown at src/applications/herald/management/HeraldTestManagementWorkflow.php:43

          ),
        ));
  }

  public function execute(PhutilArgumentParser $args) {
    $viewer = $this->getViewer();

    $object_name = $args->getArg('object');
    if (!strlen($object_name)) {
      throw new PhutilArgumentUsageException(
        pht('Specify an object to test rules for with "--object".'));
    }

    $objects = id(new PhabricatorObjectQuery())
      ->setViewer($viewer)
      ->withNames(array($object_name))
      ->execute();
    if (!$objects) {
      throw new PhutilArgumentUsageException(
        pht(
          'Unable to load specified object ("%s").',
          $object_name));
    }
    $object = head($objects);

    $adapters = HeraldAdapter::getAllAdapters();

    $can_select = array();
    $display_adapters = array();
    foreach ($adapters as $key => $adapter) {
      if (!$adapter->isTestAdapterForObject($object)) {
        continue;
      }

      if (!$adapter->isAvailableToUser($viewer)) {
        continue;
      }

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Use a valid, existing monogram (T123, D456, P1, M9 ...); copy it fresh from the UI URL.
  2. If you only know a title, resolve the monogram in the UI or via Conduit (maniphest.query.search etc.) first.
  3. Confirm the script runs against the right environment/database.
  4. Check the object is not deleted/Archived beyond the viewer's visibility.

Example fix

# before
bin/herald test --object mytask --type maniphest.task

# after
bin/herald test --object T123 --type maniphest.task
Defensive patterns

Strategy: validation

Validate before calling

// Verify the name resolves before running the workflow
$objects = id(new PhabricatorObjectQuery())
  ->setViewer($viewer)
  ->withNames(array($object_name))
  ->execute();
if (!$objects) {
  // suggest: use a monogram from the object's URL (T123, D456, ...)
}

Type guard

function isPhabricatorMonogram($s) {
  return is_string($s) && preg_match('/^[A-Z]\d+$/', $s) === 1;
}

Try / catch

try {
  (new HeraldTestManagementWorkflow())->execute($args);
} catch (PhutilArgumentUsageException $ex) {
  if (strpos($ex->getMessage(), 'Unable to load specified object') !== false) {
    // re-check the monogram against the UI, confirm environment, retry
  }
}

Prevention

When it happens

Trigger: Running 'bin/herald test --object T99999' for a nonexistent task; passing a plain word ('--object mytask') that matches no object name; typo in the monogram; object deleted between copy and paste; running against the wrong database/environment.

Common situations: Monograms copied from stale emails or search results after the object was deleted; scripts parameterized by object name where the name is a title rather than a monogram; testing on a dev checkout pointed at an empty database.

Related errors


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