{"record":{"id":"86a68ef770454851","repo":"phacility/phabricator","slug":"failed-to-find-an-oauth-client-with-id-s-86a68e","errorCode":null,"errorMessage":"Failed to find an OAuth client with ID %s.","messagePattern":"Failed to find an OAuth client with ID (.+?)\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"error","filePath":"src/applications/auth/management/PhabricatorAuthManagementUntrustOAuthClientWorkflow.php","lineNumber":40,"sourceCode":"  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $id = $args->getArg('id');\n\n    if (!$id) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Specify an OAuth client ID with %s.',\n          '--id'));\n    }\n\n    $client = id(new PhabricatorOAuthServerClientQuery())\n      ->setViewer($this->getViewer())\n      ->withIDs(array($id))\n      ->executeOne();\n\n    if (!$client) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Failed to find an OAuth client with ID %s.', $id));\n    }\n\n    if (!$client->getIsTrusted()) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'OAuth client \"%s\" is already untrusted.',\n          $client->getName()));\n    }\n\n    $client->setIsTrusted(0);\n    $client->save();\n\n    $console = PhutilConsole::getConsole();\n    $console->writeOut(\n      \"%s\\n\",\n      pht(","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/auth/management/PhabricatorAuthManagementUntrustOAuthClientWorkflow.php#L22-L58","documentation":"Thrown by `bin/auth untrust-oauth-client` when the `--id` value resolves to no OAuth client row. The workflow queries PhabricatorOAuthServerClientQuery->withIDs()->executeOne(); a null result aborts with this PhutilArgumentUsageException before the trust flag is inspected or modified. Nothing is written.","triggerScenarios":"Running `bin/auth untrust-oauth-client --id N` where N is not the numeric ID of an existing client: typo, a PHID passed instead of the numeric id, the client was deleted, or the command runs against a different database than expected.","commonSituations":"The client was removed but a scheduled job still references its ID; staging/production database mismatch; the operator copied the client name or PHID from the URL instead of the list's ID column.","solutions":["Verify the client exists and get its numeric ID: `SELECT id, name, isTrusted FROM oauth_server_oauthserverclient;` or check the OAuth Server application UI.","Re-run with the correct numeric ID: `bin/auth untrust-oauth-client --id <id>`.","Confirm the CLI targets the intended environment (correct local.json / database config).","If the client no longer exists, it can no longer be trusted, so no untrust action is required."],"exampleFix":"// before\n$ bin/auth untrust-oauth-client --id 99\nFailed to find an OAuth client with ID 99.\n\n// after\n$ bin/auth untrust-oauth-client --id 7","handlingStrategy":"validation","validationCode":"$client = id(new PhabricatorOAuthServerClientQuery())\n  ->setViewer(PhabricatorUser::getOmnipotentUser())\n  ->withIDs(array($client_id))\n  ->executeOne();\nif (!$client) {\n  // resolve the real client ID before running untrust-oauth-client\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify the client ID exists in the target environment before running untrust commands.","Use the numeric ID column from the OAuth Server UI, not PHIDs or names.","Re-check IDs after client records are created/deleted by other admins."],"tags":["phabricator","cli","oauth","usage-exception","record-not-found"],"backgroundTag":"entity-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}