phacility/phabricator · error · PhutilArgumentUsageException

No such device "%s" exists!

Error message

No such device "%s" exists!

What it means

Usage exception from `bin/almanac register`: the --device value did not match any Almanac device. The workflow runs AlmanacDeviceQuery->withNames([$device_name])->executeOne() as the CLI viewer; an empty result means no device with that exact name is visible, so registration cannot proceed. Device names are normalized (lowercase, namespace-prefixed when namespaces are configured).

Source

Thrown at src/applications/almanac/management/AlmanacManagementRegisterWorkflow.php:51

          ),
        ));
  }

  public function execute(PhutilArgumentParser $args) {
    $viewer = $this->getViewer();

    $device_name = $args->getArg('device');
    if (!strlen($device_name)) {
      throw new PhutilArgumentUsageException(
        pht('Specify a device with --device.'));
    }

    $device = id(new AlmanacDeviceQuery())
      ->setViewer($viewer)
      ->withNames(array($device_name))
      ->executeOne();
    if (!$device) {
      throw new PhutilArgumentUsageException(
        pht('No such device "%s" exists!', $device_name));
    }

    $identify_as = $args->getArg('identify-as');

    $raw_device = $device_name;
    if (strlen($identify_as)) {
      $raw_device = $identify_as;
    }

    $identity_device = id(new AlmanacDeviceQuery())
      ->setViewer($viewer)
      ->withNames(array($raw_device))
      ->executeOne();
    if (!$identity_device) {
      throw new PhutilArgumentUsageException(
        pht(
          'No such device "%s" exists!', $raw_device));

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Look the device up in the Almanac UI (or via almanac.device.search) and use its exact canonical name.
  2. Check name normalization: names are lowercased and may carry a namespace prefix configured in almanac.namespaces; copy the name the UI shows.
  3. If the device genuinely does not exist, create it first (web UI or almanac.device.edit) and add its SSH public key, then rerun register.
  4. Verify the CLI is talking to the right install if you run multiple instances.

Example fix

# before
$ bin/almanac register --device WEB1 --private-key ./id
Usage Exception: No such device "WEB1" exists!

# after (use canonical name, e.g. namespace 'host')
$ bin/almanac register --device host.web-001 --private-key ./id
Defensive patterns

Strategy: validation

Validate before calling

// Verify the device exists before registering
$device = id(new AlmanacDeviceQuery())
  ->setViewer($viewer)
  ->withNames(array($device_name))
  ->executeOne();
if (!$device) {
  throw new RuntimeException("Device '{$device_name}' not found; check name/namespace.");
}

Try / catch

# shell: probe first, then register
bin/almanac device --name "$ALMANAC_DEVICE" >/dev/null 2>&1 || {
  echo "device $ALMANAC_DEVICE missing" >&2; exit 1; }
bin/almanac register --device "$ALMANAC_DEVICE" ...

Prevention

When it happens

Trigger: bin/almanac register --device Web001 when the device is named web-001 or with a namespace prefix like host.web-001; the device exists in a different Phabricator instance than the one the CLI talks to; the device was deleted; typo in the name.

Common situations: Case or punctuation mismatches against Almanac name normalization rules; registering against the wrong instance (PHABRICATOR_ENV / phabricator.base-uri mismatch); device not yet created before host provisioning runs; shell variable expansion producing an unexpected string.

Related errors


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