phacility/phabricator · warning · PhutilArgumentUsageException

No accounts match the arguments!

Error message

No accounts match the arguments!

What it means

After applying the --user filter, the PhabricatorExternalAccountQuery (requiring view+edit capabilities) returns no rows: no linked external (OAuth/SSO) accounts match, so the workflow has nothing to refresh and aborts with a usage exception instead of pretending success.

Source

Thrown at src/applications/auth/management/PhabricatorAuthManagementRefreshWorkflow.php:53

    $username = $args->getArg('user');
    if (strlen($username)) {
      $user = id(new PhabricatorPeopleQuery())
        ->setViewer($viewer)
        ->withUsernames(array($username))
        ->executeOne();
      if ($user) {
        $query->withUserPHIDs(array($user->getPHID()));
      } else {
        throw new PhutilArgumentUsageException(
          pht('No such user "%s"!', $username));
      }
    }

    $accounts = $query->execute();

    if (!$accounts) {
      throw new PhutilArgumentUsageException(
        pht('No accounts match the arguments!'));
    } else {
      $console->writeOut(
        "%s\n",
        pht(
          'Found %s account(s) to refresh.',
          phutil_count($accounts)));
    }

    $providers = PhabricatorAuthProvider::getAllEnabledProviders();
    $providers = mpull($providers, null, 'getProviderConfigPHID');

    foreach ($accounts as $account) {
      $console->writeOut(
        "%s\n",
        pht(
          'Refreshing account #%d.',
          $account->getID()));

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Run './bin/auth refresh' without --user to see whether any external accounts exist at all.
  2. Check the target user's Settings > External Accounts (or Auth > Connected Accounts) to confirm a link exists.
  3. Skip this workflow on installs with no OAuth2 providers — there is nothing to refresh.
Defensive patterns

Strategy: validation

Validate before calling

// Verify there is anything to refresh before invoking.
$accounts = id(new PhabricatorExternalAccountQuery())
  ->setViewer($viewer)
  ->requireCapabilities(array(
    PhabricatorPolicyCapability::CAN_VIEW,
    PhabricatorPolicyCapability::CAN_EDIT,
  ))
  ->withUserPHIDs(array($user->getPHID()))
  ->execute();
if (!$accounts) {
  // nothing linked: skip the refresh with an explanatory message
}

Prevention

When it happens

Trigger: Refreshing a user who never linked an external account; running on an install that uses only password auth (no external accounts exist at all); the operator's viewer lacking edit access to the accounts.

Common situations: Running the refresh tool on fresh or password-only installs; testing OAuth wiring before any user has actually linked an account; wrong --user for whom accounts exist.

Related errors


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