{"record":{"id":"f27056c45510ec19","repo":"phacility/phabricator","slug":"no-public-key-exists-with-id-s-f27056","errorCode":null,"errorMessage":"No public key exists with ID \"%s\".","messagePattern":"No public key exists with ID \"(.+?)\"\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"error","filePath":"src/applications/almanac/management/AlmanacManagementUntrustKeyWorkflow.php","lineNumber":34,"sourceCode":"          ),\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);\n    $key->save();\n\n    PhabricatorAuthSSHKeyQuery::deleteSSHKeyCache();\n\n    $console->writeOut(\n      \"**<bg:green> %s </bg>** %s\\n\",\n      pht('TRUST REVOKED'),\n      pht('Trust has been revoked for public key %s.', $id));\n  }","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/almanac/management/AlmanacManagementUntrustKeyWorkflow.php#L16-L52","documentation":"The untrust-key workflow loaded no SSH public key for the given --id. PhabricatorAuthSSHKeyQuery withIDs(array($id)) executed and executeOne() returned null, meaning no key row has that ID.","triggerScenarios":"Running ./bin/almanac untrust-key --id N where N does not match any row in the auth SSH key table (typo, stale ID from a deleted key, ID confused with a PHID or another object's ID).","commonSituations":"Using an ID copied from a different install or a key deleted after the admin note was written; mixing up the key ID shown in URLs of other objects.","solutions":["Locate the correct numeric key ID on the device's detail page in Almanac (or SSH key search) and retry with it.","If the key was deleted, there is nothing to untrust; confirm the trust state of the remaining device keys instead.","Double-check you passed the key's numeric ID, not a PHID or user ID."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"$key = id(new PhabricatorAuthSSHKeyQuery())\n  ->setViewer($viewer)\n  ->withIDs(array($id))\n  ->executeOne();\nif (!$key) {\n  // Fail with your own actionable message instead of the workflow's.\n  throw new Exception(\"SSH key {$id} not found; list keys on the device page.\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  // run untrust-key\n} catch (PhutilArgumentUsageException $ex) {\n  if (preg_match('/No public key exists with ID/', $ex->getMessage())) {\n    // Wrong or stale ID: re-resolve the device's key ID and retry once.\n  } else {\n    throw $ex;\n  }\n}","preventionTips":["Resolve key IDs dynamically (query by device PHID) instead of hardcoding them.","After deleting keys, prune them from runbooks and scripts the same day.","Remember IDs are numeric; PHIDs are never accepted here."],"tags":["almanac","ssh-keys","not-found","cli","phabricator"],"backgroundTag":"entity-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}