phacility/phabricator · warning · PhutilArgumentUsageException

Argument "%s" does not name a buildable. Provide one or more

Error message

Argument "%s" does not name a buildable. Provide one or more valid buildable monograms or PHIDs.

What it means

Per-argument resolution check in `harbormaster publish`: all names were run through PhabricatorObjectQuery->withNames(), and getNamedResults() is consulted for each input; any name that produced no named result throws, listing the offending argument. Note this fires before the type check that follows, so it concerns resolution, not buildability.

Source

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

    $buildable_names = $args->getArg('buildable');
    if (!$buildable_names) {
      throw new PhutilArgumentUsageException(
        pht(
          'Name one or more buildables to publish, like "B123".'));
    }

    $query = id(new PhabricatorObjectQuery())
      ->setViewer($viewer)
      ->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)));
      }
    }

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Correct or drop the offending name and re-run with only resolvable buildable monograms (B123) or full PHIDs.
  2. Pre-validate names (phid.lookup / object query) before invoking publish in scripts.
  3. Trim punctuation/whitespace from generated name lists.

Example fix

# before
./bin/phabricator harbormaster publish B123, B12x

# after
./bin/phabricator harbormaster publish B123
Defensive patterns

Strategy: validation

Validate before calling

// Pre-resolve every name before invoking publish:
$query = id(new PhabricatorObjectQuery())
  ->setViewer($viewer)
  ->withNames($buildable_names);
$query->execute();
$valid = array_keys($query->getNamedResults());
$buildable_names = array_intersect($buildable_names, $valid); // drop unresolvable

Type guard

function allNamesResolve($viewer, array $names) {
  $query = id(new PhabricatorObjectQuery())
    ->setViewer($viewer)
    ->withNames($names);
  $query->execute();
  $results = $query->getNamedResults();
  foreach ($names as $name) {
    if (empty($results[$name])) { return false; }
  }
  return true;
}

Try / catch

try {
  runPublishWorkflow($args);
} catch (PhutilArgumentUsageException $e) {
  if (preg_match('/does not name a buildable/', $e->getMessage())) {
    // remove the offending argument and re-run with the valid subset
  }
}

Prevention

When it happens

Trigger: One bad name in a batch ('B12x' among valid B123-style monograms); a PHID string that is well-formed but unknown; names the acting CLI viewer cannot resolve; copy-paste artifacts (trailing commas become separate arguments).

Common situations: Mixed-quality lists from automation; environments where buildables were garbage-collected between list generation and publish; trailing punctuation creating bogus extra arguments.

Related errors


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