phacility/phabricator · error · PhutilArgumentUsageException
Failed to find an OAuth client with ID %s.
Error message
Failed to find an OAuth client with ID %s.
What it means
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.
Source
Thrown at src/applications/auth/management/PhabricatorAuthManagementUntrustOAuthClientWorkflow.php:40
}
public function execute(PhutilArgumentParser $args) {
$id = $args->getArg('id');
if (!$id) {
throw new PhutilArgumentUsageException(
pht(
'Specify an OAuth client ID with %s.',
'--id'));
}
$client = id(new PhabricatorOAuthServerClientQuery())
->setViewer($this->getViewer())
->withIDs(array($id))
->executeOne();
if (!$client) {
throw new PhutilArgumentUsageException(
pht(
'Failed to find an OAuth client with ID %s.', $id));
}
if (!$client->getIsTrusted()) {
throw new PhutilArgumentUsageException(
pht(
'OAuth client "%s" is already untrusted.',
$client->getName()));
}
$client->setIsTrusted(0);
$client->save();
$console = PhutilConsole::getConsole();
$console->writeOut(
"%s\n",
pht(View on GitHub (pinned to 5720a38cfe)
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.
Example fix
// before $ bin/auth untrust-oauth-client --id 99 Failed to find an OAuth client with ID 99. // after $ bin/auth untrust-oauth-client --id 7
Defensive patterns
Strategy: validation
Validate before calling
$client = id(new PhabricatorOAuthServerClientQuery())
->setViewer(PhabricatorUser::getOmnipotentUser())
->withIDs(array($client_id))
->executeOne();
if (!$client) {
// resolve the real client ID before running untrust-oauth-client
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Failed to find an OAuth client with id %s.
- No user exists with username "%s".
- Specify an OAuth client ID with %s.
- No email exists with address "%s"!
- OAuth client "%s" is already trusted.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/86a68ef770454851.
Report an issue: GitHub.