{"record":{"id":"4acbbf1bdacaf190","repo":"phacility/phabricator","slug":"specify-a-public-key-to-revoke-trust-for-with-id","errorCode":null,"errorMessage":"Specify a public key to revoke trust for with --id.","messagePattern":"Specify a public key to revoke trust for with --id\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"error","filePath":"src/applications/almanac/management/AlmanacManagementUntrustKeyWorkflow.php","lineNumber":25,"sourceCode":"    $this\n      ->setName('untrust-key')\n      ->setSynopsis(pht('Revoke trust of a public key.'))\n      ->setArguments(\n        array(\n          array(\n            'name' => 'id',\n            'param' => 'id',\n            'help' => pht('ID of the key to revoke trust for.'),\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 revoke trust for 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->getIsTrusted()) {\n      throw new PhutilArgumentUsageException(\n        pht('Public key with ID %s is not trusted.', $id));\n    }\n\n    $key->setIsTrusted(0);","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/almanac/management/AlmanacManagementUntrustKeyWorkflow.php#L7-L43","documentation":"Usage error from the Almanac 'untrust-key' workflow: the required --id argument was omitted or empty. $args->getArg('id') returned a falsy value before any database lookup happened, so Phabricator immediately rejects the invocation.","triggerScenarios":"Running ./bin/almanac untrust-key with no --id flag, or with --id followed by an empty string.","commonSituations":"Muscle-memory invocation copied from trust-key docs without editing; shell scripts where the $KEY_ID variable expanded to empty.","solutions":["Run ./bin/almanac untrust-key --id <keyID> with the numeric ID of the trusted key.","Find the ID on the device's page in Almanac or via SSH key search before running.","In scripts, guard the variable: [ -n \"$KEY_ID\" ] || { echo 'missing KEY_ID'; exit 1; }"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Shell-level guard before invoking:\n// [ -n \"$KEY_ID\" ] || { echo 'error: KEY_ID is required (--id)' >&2; exit 1; }\n// ./bin/almanac untrust-key --id \"$KEY_ID\"\n// PHP-level, when building the parser args programmatically:\nif (!strlen((string)$args->getArg('id'))) {\n  throw new PhutilArgumentUsageException(pht('Specify a public key to revoke trust for with --id.'));\n}","typeGuard":null,"tryCatchPattern":"try {\n  $err = new PhutilArgumentUsageException(...); // or call workflow\n} catch (PhutilArgumentUsageException $ex) {\n  // Missing-argument usage error: show help text and exit 2 (usage convention).\n  fwrite(STDERR, $ex->getMessage().\"\\n\");\n  exit(2);\n}","preventionTips":["Always pass --id explicitly; never rely on positional arguments for this workflow.","Assert required environment variables are non-empty at the top of deploy scripts.","Wrap recurring admin commands in a small runbook script that validates its inputs first."],"tags":["almanac","cli","missing-argument","phabricator","ssh-keys"],"backgroundTag":"missing-cli-argument","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}