phacility/phabricator · error · PhutilAggregateException

Unable to read device public key while attempting to make…

Error message

Unable to read device public key while attempting to make authenticated method call within the cluster. Use `%s` to register keys for this device. Exception: %s

What it means

Error "Unable to read device public key while attempting to make authenticated method call within the cluster. Use `%s` to register keys for this device. Exception: %s" thrown in phacility/phabricator.

Solutions

  1. Run bin/almanac register on this host to generate and register the device keypair.
  2. Verify the device.pub file exists in the configured Almanac key path and is readable.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/applications/repository/storage/PhabricatorRepository.php:2209 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


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

Appendix: source

Thrown at src/applications/repository/storage/PhabricatorRepository.php:2209

      ));
    if ($uri === null) {
      return null;
    }

    $domain = id(new PhutilURI(PhabricatorEnv::getURI('/')))->getDomain();

    $client = id(new ConduitClient($uri))
      ->setHost($domain);

    if ($viewer->isOmnipotent()) {
      // If the caller is the omnipotent user (normally, a daemon), we will
      // sign the request with this host's asymmetric keypair.

      $public_path = AlmanacKeys::getKeyPath('device.pub');
      try {
        $public_key = Filesystem::readFile($public_path);
      } catch (Exception $ex) {
        throw new PhutilAggregateException(
          pht(
            'Unable to read device public key while attempting to make '.
            'authenticated method call within the cluster. '.
            'Use `%s` to register keys for this device. Exception: %s',
            'bin/almanac register',
            $ex->getMessage()),
          array($ex));
      }

      $private_path = AlmanacKeys::getKeyPath('device.key');
      try {
        $private_key = Filesystem::readFile($private_path);
        $private_key = new PhutilOpaqueEnvelope($private_key);
      } catch (Exception $ex) {
        throw new PhutilAggregateException(
          pht(
            'Unable to read device private key while attempting to make '.
            'authenticated method call within the cluster. '.

View on GitHub (pinned to 5720a38cfe)