phacility/phabricator · error · PhutilArgumentUsageException

Blueprint "%s" is specified more than once (as "%s" and "%s"

Error message

Blueprint "%s" is specified more than once (as "%s" and "%s").

What it means

A PhutilArgumentUsageException from `bin/drydock lease --blueprint` when two different identifiers in the repeatable flag resolve to the same blueprint PHID — classically the blueprint given once by ID and once by PHID. The workflow keeps a $seen map of PHIDs and rejects the second reference to avoid acquiring the same blueprint twice.

Source

Thrown at src/applications/drydock/management/DrydockManagementLeaseWorkflow.php:297

    $blueprints = mpull($blueprints, null, 'getPHID');

    $map = $query->getIdentifierMap();

    $seen = array();
    foreach ($identifiers as $identifier) {
      if (!isset($map[$identifier])) {
        throw new PhutilArgumentUsageException(
          pht(
            'Blueprint "%s" could not be loaded. Try a blueprint ID or '.
            'PHID.',
            $identifier));
      }

      $blueprint = $map[$identifier];

      $blueprint_phid = $blueprint->getPHID();
      if (isset($seen[$blueprint_phid])) {
        throw new PhutilArgumentUsageException(
          pht(
            'Blueprint "%s" is specified more than once (as "%s" and "%s").',
            $blueprint->getBlueprintName(),
            $seen[$blueprint_phid],
            $identifier));
      }

      $seen[$blueprint_phid] = true;
    }

    return mpull($map, null, 'getPHID');
  }

  private function newAllowedBlueprintPHIDs(
    DrydockLease $lease,
    array $filter_blueprints) {
    assert_instances_of($filter_blueprints, 'DrydockBlueprint');

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Pass each blueprint exactly once, using one identifier style consistently (all IDs or all PHIDs).
  2. Deduplicate identifier lists in scripts before invoking the CLI (resolve each to a PHID and unique it).

Example fix

# before
bin/drydock lease --type host --blueprint 3 --blueprint PHID-DRYB-sameblueprint

# after
bin/drydock lease --type host --blueprint 3
Defensive patterns

Strategy: validation

Validate before calling

// resolve each identifier to a PHID, then dedupe before calling the CLI
$query = id(new DrydockBlueprintQuery())
  ->setViewer($viewer)
  ->withIdentifiers($identifiers);
$query->execute();
$map = $query->getIdentifierMap();
$phids = array_unique(mpull($map, 'getPHID', null));
// pass each distinct PHID exactly once

Prevention

When it happens

Trigger: `bin/drydock lease --type host --blueprint 3 --blueprint PHID-DRYB-sameblueprint` where both '3' and the PHID resolve to blueprint 3; identifiers built dynamically by concatenating an explicit ID with a config-provided PHID for the same blueprint.

Common situations: Configuration lists a blueprint ID and a monitoring script appends its PHID; documentation examples mixing the two identifier styles get combined.

Related errors


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