phacility/phabricator · warning · PhutilArgumentUsageException

Object "%s" is not a HarbormasterBuildable (it is a "%s"). N

Error message

Object "%s" is not a HarbormasterBuildable (it is a "%s"). Name one or more buildables to publish, like "B123".

What it means

Thrown by the 'bin/harbormaster publish' management workflow. It first resolves each command-line name (monogram or PHID) through PhabricatorObjectQuery; any name that does not resolve at all fails earlier, but a name that resolves to an object of the wrong type reaches this check. Publishing buildables only makes sense for HarbormasterBuildable objects, so anything else (a task, a revision, a commit) is rejected with the offending name and its actual class.

Source

Thrown at src/applications/harbormaster/management/HarbormasterManagementPublishWorkflow.php:53

      ->withNames($buildable_names);

    $query->execute();

    $result_map = $query->getNamedResults();

    foreach ($buildable_names as $name) {
      if (!isset($result_map[$name])) {
        throw new PhutilArgumentUsageException(
          pht(
            'Argument "%s" does not name a buildable. Provide one or more '.
            'valid buildable monograms or PHIDs.',
            $name));
      }
    }

    foreach ($result_map as $name => $result) {
      if (!($result instanceof HarbormasterBuildable)) {
        throw new PhutilArgumentUsageException(
          pht(
            'Object "%s" is not a HarbormasterBuildable (it is a "%s"). '.
            'Name one or more buildables to publish, like "B123".',
            $name,
            get_class($result)));
      }
    }

    foreach ($result_map as $buildable) {
      echo tsprintf(
        "%s\n",
        pht(
          'Publishing "%s"...',
        $buildable->getMonogram()));

      // Reload the buildable to pick up builds.
      $buildable = id(new HarbormasterBuildableQuery())
        ->setViewer($viewer)

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Pass buildable monograms only, e.g. 'bin/harbormaster publish B123' (multiple are allowed: 'B123 B124')
  2. If you use PHIDs, confirm they start with PHID-HMBB- (HarbormasterBuildable) and exist in this instance
  3. Look up the correct buildable from the build or commit page, or via the harbormaster.buildable.search Conduit method, before publishing

Example fix

# before
$ bin/harbormaster publish D123
# Object "D123" is not a HarbormasterBuildable (it is a "DifferentialRevision").
# after
$ bin/harbormaster publish B123
Defensive patterns

Strategy: type-guard

Validate before calling

$results = id(new PhabricatorObjectQuery())
  ->setViewer($viewer)
  ->withNames($names)
  ->execute();
foreach ($results as $name => $object) {
  if (!($object instanceof HarbormasterBuildable)) {
    // report and stop before invoking the publish workflow
  }
}

Type guard

function isHarbormasterBuildable($object) {
  return ($object instanceof HarbormasterBuildable);
}

Prevention

When it happens

Trigger: Running 'bin/harbormaster publish D123' or 'bin/harbormaster publish T123' where the monogram resolves to a DifferentialRevision or ManiphestTask; passing a PHID of a non-HMBB type (e.g. PHID-TASK-...) from a script into the publish workflow.

Common situations: Scripts that feed arbitrary object names or PHIDs into the CLI without filtering by type; typos that coincidentally match another object type's monogram; assuming any valid object name is accepted because name resolution succeeded.

Related errors


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