phacility/phabricator · warning · PhutilArgumentUsageException

User account "%s" is already an administrator. You can only

Error message

User account "%s" is already an administrator. You can only empower accounts that are not yet administrators.

What it means

Thrown by `bin/people empower --user <username>` when the target account already has isAdmin set. The empower workflow only turns a regular user into an administrator; empowering an existing administrator is a no-op state transition, so the command aborts with a PhutilArgumentUsageException instead of applying an empty transaction.

Source

Thrown at src/applications/people/management/PhabricatorPeopleManagementEmpowerWorkflow.php:23

  protected function didConstruct() {
    $arguments = array_merge(
      $this->getUserSelectionArguments(),
      array());

    $this
      ->setName('empower')
      ->setExamples('**empower** --user __username__')
      ->setSynopsis(pht('Turn a user account into an administrator account.'))
      ->setArguments($arguments);
  }

  public function execute(PhutilArgumentParser $args) {
    $user = $this->selectUser($args);
    $display_name = $user->getUsername();

    if ($user->getIsAdmin()) {
      throw new PhutilArgumentUsageException(
        pht(
          'User account "%s" is already an administrator. You can only '.
          'empower accounts that are not yet administrators.',
          $display_name));
    }

    $xactions = array();
    $xactions[] = $user->getApplicationTransactionTemplate()
      ->setTransactionType(PhabricatorUserEmpowerTransaction::TRANSACTIONTYPE)
      ->setNewValue(true);

    $this->applyTransactions($user, $xactions);

    $this->logOkay(
      pht('DONE'),
      pht('Empowered user account "%s".', $display_name));

    return 0;

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. No fix needed - the account is already an administrator; verify the 'Administrator' badge on the People profile
  2. In scripts, check isAdmin (Conduit user.query / PhabricatorPeopleQuery) before invoking empower
  3. Treat the 'already an administrator' usage exception as a successful no-op in automation

Example fix

# before
./bin/people empower --user alice
# after (idempotent script guard)
./bin/people empower --user "$USERNAME" 2>&1 | grep -q 'already an administrator' \
  && echo "$USERNAME: already admin (ok)"
Defensive patterns

Strategy: validation

Validate before calling

$user = id(new PhabricatorPeopleQuery())
  ->setViewer($viewer)
  ->withUsernames(array($username))
  ->executeOne();
if (!$user || $user->getIsAdmin()) {
  return; // already an administrator
}

Type guard

function isAlreadyAdmin(PhabricatorUser $user) {
  return (bool)$user->getIsAdmin();
}

Prevention

When it happens

Trigger: Running `./bin/people empower --user alice` on an account that is already an administrator; promotion scripts re-run against the same users; promoting a user who was elevated through the admin UI earlier.

Common situations: Repeat runs of provisioning automation; operators double-running the command to 'make sure';恢复 scripts after partial failures that already elevated the account.

Related errors


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