phacility/phabricator · error · PhutilArgumentUsageException

Specify an OAuth client ID with %s.

Error message

Specify an OAuth client ID with %s.

What it means

Thrown by `bin/auth untrust-oauth-client` when the `--id` argument is omitted, empty, or evaluates falsy. The workflow requires a numeric OAuth client ID up front and aborts with this PhutilArgumentUsageException before constructing any query. No database access has happened yet.

Source

Thrown at src/applications/auth/management/PhabricatorAuthManagementUntrustOAuthClientWorkflow.php:28

      ->setSynopsis(
        pht(
          'Remove trust from an OAuth client. Users must manually confirm '.
          'reauthorization of untrusted OAuth clients.'))
      ->setArguments(
        array(
          array(
            'name' => 'id',
            'param' => 'id',
            'help' => pht('The id of the OAuth client.'),
          ),
        ));
  }

  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(

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Re-run with the flag: `bin/auth untrust-oauth-client --id <client-id>`.
  2. Find the numeric client ID in Applications -> OAuth Server or via `SELECT id, name FROM oauth_server_oauthserverclient;`.
  3. Guard scripts with a check that the ID variable is non-empty before invoking the command.

Example fix

// before
$ bin/auth untrust-oauth-client
Specify an OAuth client ID with --id.

// after
$ bin/auth untrust-oauth-client --id 7
Defensive patterns

Strategy: validation

Validate before calling

// Guard scripts: refuse to invoke without an id
if [ -z "$CLIENT_ID" ]; then echo "CLIENT_ID required" >&2; exit 2; fi
bin/auth untrust-oauth-client --id "$CLIENT_ID"

Prevention

When it happens

Trigger: Running `bin/auth untrust-oauth-client` with no flags, or with an empty `--id` value (e.g. `--id "$CLIENT_ID"` where the shell variable is unset); passing the ID positionally instead of via `--id`.

Common situations: Automation script interpolates a missing variable; the operator assumes a positional argument works; the ID was left off because the operator expected an interactive prompt.

Related errors


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/f93d1ea3650173a6. Report an issue: GitHub.