{"record":{"id":"e953040cedf3eb22","repo":"phacility/phabricator","slug":"specify-a-public-key-to-trust-with-id","errorCode":null,"errorMessage":"Specify a public key to trust with --id.","messagePattern":"Specify a public key to trust with --id\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/almanac/management/AlmanacManagementTrustKeyWorkflow.php","lineNumber":25,"sourceCode":"    $this\n      ->setName('trust-key')\n      ->setSynopsis(pht('Mark a public key as trusted.'))\n      ->setArguments(\n        array(\n          array(\n            'name' => 'id',\n            'param' => 'id',\n            'help' => pht('ID of the key to trust.'),\n          ),\n        ));\n  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $console = PhutilConsole::getConsole();\n\n    $id = $args->getArg('id');\n    if (!$id) {\n      throw new PhutilArgumentUsageException(\n        pht('Specify a public key to trust with --id.'));\n    }\n\n    $key = id(new PhabricatorAuthSSHKeyQuery())\n      ->setViewer($this->getViewer())\n      ->withIDs(array($id))\n      ->executeOne();\n    if (!$key) {\n      throw new PhutilArgumentUsageException(\n        pht('No public key exists with ID \"%s\".', $id));\n    }\n\n    if (!$key->getIsActive()) {\n      throw new PhutilArgumentUsageException(\n        pht('Public key \"%s\" is not an active key.', $id));\n    }\n\n    if ($key->getIsTrusted()) {","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/almanac/management/AlmanacManagementTrustKeyWorkflow.php#L7-L43","documentation":"Usage exception from `bin/almanac trust-key`: the --id flag is missing, empty, or falsy. The workflow trusts exactly one SSH public key per invocation, addressed by its numeric ID in the PhabricatorAuthSSHKey table, so the ID is mandatory.","triggerScenarios":"Running `bin/almanac trust-key` bare; passing --id \"\" from a script variable that failed to populate; using --key or --phid instead of --id.","commonSituations":"Scripted key-trust steps where the ID extraction (from the UI or almanac/device search output) silently failed; operators assuming the command is interactive.","solutions":["Get the key ID from the device's Manage -> SSH Keys panel (or the database/auth.sshkey search) and pass it: bin/almanac trust-key --id <id>.","In scripts, abort if the ID variable is empty instead of calling the CLI with a blank --id.","Remember the command trusts one key per run; loop over IDs if you have several."],"exampleFix":"# before\n$ bin/almanac trust-key\nUsage Exception: Specify a public key to trust with --id.\n\n# after\n$ bin/almanac trust-key --id 42","handlingStrategy":"validation","validationCode":": \"${TRUST_KEY_ID:?SSH public key ID required (device -> Manage -> SSH Keys)}\"\nbin/almanac trust-key --id \"$TRUST_KEY_ID\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Fail fast in scripts when the key ID variable is unset (: ${VAR:?}).","One trust-key invocation per key; loop when trusting several.","Keep the key ID inventory (device -> key id) in your provisioning data."],"tags":["phabricator","almanac","cli","usage-error","trust-key"],"backgroundTag":"missing-cli-argument","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}