phacility/phabricator · error · Exception

Working copy lease is missing required attribute "%s". Attr

Error message

Working copy lease is missing required attribute "%s".

Attribute "repositories.map" should be a map of repository specifications.

What it means

The working-copy blueprint expects leases to carry a `repositories.map` attribute describing which repositories to check out; it validates the attribute when building the map. If the attribute is missing entirely, the first message line reported is that the lease is missing the required attribute, followed by an explanation of the expected shape (a map of repository specifications). Callers of Drydock requesting working-copy leases must set this attribute before activation.

Source

Thrown at src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php:172

    if (!is_array($map) || !$map) {
      $message = array();
      if ($map === null) {
        $message[] = pht(
          'Working copy lease is missing required attribute "%s".',
          $attribute);
      } else {
        $message[] = pht(
          'Working copy lease has invalid attribute "%s".',
          $attribute);
      }

      $message[] = pht(
        'Attribute "repositories.map" should be a map of repository '.
        'specifications.');

      $message = implode("\n\n", $message);

      throw new Exception($message);
    }

    foreach ($map as $key => $value) {
      $map[$key] = array_select_keys(
        $value,
        array(
          'phid',
        ));
    }

    return $map;
  }

  public function activateResource(
    DrydockBlueprint $blueprint,
    DrydockResource $resource) {

    $lease = $this->loadHostLease($resource);

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Set the attribute on the lease before queueing: setAttribute('repositories.map', array(...)) with one entry per repository
  2. Each map entry needs at least a 'phid' key naming the repository PHID to clone
  3. Acquire the lease only after all required attributes are set, and log attributes before queueing in custom code

Example fix

// before
$lease = id(new DrydockLease())
  ->setResourceType('working-copy')
  ->queueForActivate();
// after
$lease = id(new DrydockLease())
  ->setResourceType('working-copy')
  ->setAttribute(
    'repositories.map',
    array(
      array('phid' => 'PHID-REPO-xxxxxxxxxxxxxxxxxxxx'),
    ))
  ->queueForActivate();
Defensive patterns

Strategy: validation

Validate before calling

$map = $lease->getAttribute('repositories.map');
if (!is_array($map) || !$map) {
  // Set the attribute before queueing the lease for activation.
  $lease->setAttribute(
    'repositories.map',
    array(
      array('phid' => $repository_phid),
    ));
}

Type guard

function is_valid_repositories_map($value) {
  if (!is_array($value) || !$value) {
    return false;
  }
  foreach ($value as $spec) {
    if (!is_array($spec) || empty($spec['phid'])) {
      return false;
    }
  }
  return true;
}

Prevention

When it happens

Trigger: Creating/queueing a Drydock working-copy lease without calling setAttribute('repositories.map', ...) — or setting it to a non-array — and letting the working-copy blueprint process it. The thrown Exception embeds both the missing-attribute notice and the expected format.

Common situations: Harbormaster/build integrations or custom lease-request scripts that construct the lease manually and forget the attribute; copy-paste lease code from a different blueprint type (host leases need no repositories.map); attribute key typo like 'repositories.map ' or 'repository.map'.

Related errors


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