{"record":{"id":"c2002475ddc5951e","repo":"phacility/phabricator","slug":"no-such-device-s-exists","errorCode":null,"errorMessage":"No such device \"%s\" exists!","messagePattern":"No such device \"(.+?)\" exists!","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"error","filePath":"src/applications/almanac/management/AlmanacManagementRegisterWorkflow.php","lineNumber":51,"sourceCode":"          ),\n        ));\n  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $viewer = $this->getViewer();\n\n    $device_name = $args->getArg('device');\n    if (!strlen($device_name)) {\n      throw new PhutilArgumentUsageException(\n        pht('Specify a device with --device.'));\n    }\n\n    $device = id(new AlmanacDeviceQuery())\n      ->setViewer($viewer)\n      ->withNames(array($device_name))\n      ->executeOne();\n    if (!$device) {\n      throw new PhutilArgumentUsageException(\n        pht('No such device \"%s\" exists!', $device_name));\n    }\n\n    $identify_as = $args->getArg('identify-as');\n\n    $raw_device = $device_name;\n    if (strlen($identify_as)) {\n      $raw_device = $identify_as;\n    }\n\n    $identity_device = id(new AlmanacDeviceQuery())\n      ->setViewer($viewer)\n      ->withNames(array($raw_device))\n      ->executeOne();\n    if (!$identity_device) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'No such device \"%s\" exists!', $raw_device));","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/almanac/management/AlmanacManagementRegisterWorkflow.php#L33-L69","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Look the device up in the Almanac UI (or via almanac.device.search) and use its exact canonical name.","Check name normalization: names are lowercased and may carry a namespace prefix configured in almanac.namespaces; copy the name the UI shows.","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.","Verify the CLI is talking to the right install if you run multiple instances."],"exampleFix":"# before\n$ bin/almanac register --device WEB1 --private-key ./id\nUsage Exception: No such device \"WEB1\" exists!\n\n# after (use canonical name, e.g. namespace 'host')\n$ bin/almanac register --device host.web-001 --private-key ./id","handlingStrategy":"validation","validationCode":"// Verify the device exists before registering\n$device = id(new AlmanacDeviceQuery())\n  ->setViewer($viewer)\n  ->withNames(array($device_name))\n  ->executeOne();\nif (!$device) {\n  throw new RuntimeException(\"Device '{$device_name}' not found; check name/namespace.\");\n}","typeGuard":null,"tryCatchPattern":"# shell: probe first, then register\nbin/almanac device --name \"$ALMANAC_DEVICE\" >/dev/null 2>&1 || {\n  echo \"device $ALMANAC_DEVICE missing\" >&2; exit 1; }\nbin/almanac register --device \"$ALMANAC_DEVICE\" ...","preventionTips":["Always copy the canonical device name from the UI or almanac.device.search, never from memory.","Create devices via automation (almanac.device.edit) and reuse the exact returned name for register.","Account for namespace prefixes when your install uses almanac.namespaces."],"tags":["phabricator","almanac","cli","entity-not-found","device"],"backgroundTag":"entity-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}