phacility/phabricator · error · Exception

Attempting to build a repository command

Error message

Attempting to build a repository command (for repository "%s") as device, but this host ("%s") is not configured as a cluster device.

What it means

Configuration guard in newCommonEnvironment: the command engine was asked to connect as the cluster device, but AlmanacKeys::getLiveDevice() returned null — this host's hostname is not registered as an Almanac device. Device-based authentication for repository commands therefore cannot proceed.

Solutions

  1. Register this host as an Almanac device in the cluster configuration
  2. Ensure the device hostname matches php_uname('n') / the Almanac binding
  3. Alternatively, do not connect as device if this host is not a cluster member
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/applications/diffusion/protocol/DiffusionCommandEngine.php:192 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at src/applications/diffusion/protocol/DiffusionCommandEngine.php:192

  private function newCommonEnvironment() {
    $repository = $this->getRepository();

    $env = array();
      // NOTE: Force the language to "en_US.UTF-8", which overrides locale
      // settings. This makes stuff print in English instead of, e.g., French,
      // so we can parse the output of some commands, error messages, etc.
    $env['LANG'] = 'en_US.UTF-8';

      // Propagate PHABRICATOR_ENV explicitly. For discussion, see T4155.
    $env['PHABRICATOR_ENV'] = PhabricatorEnv::getSelectedEnvironmentName();

    $as_device = $this->getConnectAsDevice();
    $credential_phid = $this->getCredentialPHID();

    if ($as_device) {
      $device = AlmanacKeys::getLiveDevice();
      if (!$device) {
        throw new Exception(
          pht(
            'Attempting to build a repository command (for repository "%s") '.
            'as device, but this host ("%s") is not configured as a cluster '.
            'device.',
            $repository->getDisplayName(),
            php_uname('n')));
      }

      if ($credential_phid) {
        throw new Exception(
          pht(
            'Attempting to build a repository command (for repository "%s"), '.
            'but the CommandEngine is configured to connect as both the '.
            'current cluster device ("%s") and with a specific credential '.
            '("%s"). These options are mutually exclusive. Connections must '.
            'authenticate as one or the other, not both.',
            $repository->getDisplayName(),
            $device->getName(),

View on GitHub (pinned to 5720a38cfe)