phacility/phabricator · error · Exception

When creating a new Almanac interface via the Conduit API, y

Error message

When creating a new Almanac interface via the Conduit API, you must provide a "device" transaction to select a device.

What it means

Thrown by PhabricatorRepository::assertValidRepositorySlug() when a repository short name exceeds 64 characters. Short names appear in clone URIs and filesystem paths, so Phabricator caps them at 64 characters to stay within filesystem and ergonomic limits. It is raised from the short-name transaction path (UI or 'repository.edit') when the proposed value is too long.

Source

Thrown at src/applications/almanac/editor/AlmanacInterfaceEditEngine.php:69

  }

  protected function newEditableObjectForDocumentation() {
    $this->setDevice(new AlmanacDevice());
    return $this->newEditableObject();
  }

  protected function newEditableObjectFromConduit(array $raw_xactions) {
    $device_phid = null;
    foreach ($raw_xactions as $raw_xaction) {
      if ($raw_xaction['type'] !== 'device') {
        continue;
      }

      $device_phid = $raw_xaction['value'];
    }

    if ($device_phid === null) {
      throw new Exception(
        pht(
          'When creating a new Almanac interface via the Conduit API, you '.
          'must provide a "device" transaction to select a device.'));
    }

    $device = id(new AlmanacDeviceQuery())
      ->setViewer($this->getViewer())
      ->withPHIDs(array($device_phid))
      ->requireCapabilities(
        array(
          PhabricatorPolicyCapability::CAN_VIEW,
          PhabricatorPolicyCapability::CAN_EDIT,
        ))
      ->executeOne();
    if (!$device) {
      throw new Exception(
        pht(
          'Device "%s" is unrecognized, restricted, or you do not have '.

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Shorten the short name to 64 characters or fewer (keep the descriptive parts, drop redundant prefixes).
  2. In provisioning code, truncate or hash overly long generated names, e.g. substr($name, 0, 64).
  3. Validate with PhabricatorRepository::isValidRepositorySlug() before submitting the transaction.

Example fix

// before
$slug = 'infrastructure-team-monitoring-agent-deployment-pipelines-and-tooling-config'; // > 64 chars

// after
$slug = 'infra-monitoring-agent-deploy-tooling'; // <= 64 chars
Defensive patterns

Strategy: type-guard

Validate before calling

if (strlen($slug) > 64) { $slug = substr($slug, 0, 64); /* then re-check trailing separator */ }

Type guard

function isValidShortName($slug) {
  return PhabricatorRepository::isValidRepositorySlug((string)$slug);
}

Try / catch

try {
  PhabricatorRepository::assertValidRepositorySlug($slug);
} catch (Exception $ex) {
  // handle over-long name: reject or truncate-and-revalidate
}

Prevention

When it happens

Trigger: Setting a repository short name longer than 64 characters via repository.edit or the web UI: the strlen($slug) > 64 check at PhabricatorRepository.php:378 throws, interpolating the offending name.

Common situations: Auto-generating slugs from long project or team names; importing repositories whose directory names exceed the limit; concatenating group prefixes plus repo names in provisioning scripts.

Related errors


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