phacility/phabricator · error · Exception

Primary email addresses can not be reassigned.

Error message

Primary email addresses can not be reassigned.

What it means

Error "Primary email addresses can not be reassigned." thrown in phacility/phabricator.

Source

Thrown at src/applications/people/editor/PhabricatorUserEditor.php:37


  /**
   * @task edit
   */
  public function createNewUser(
    PhabricatorUser $user,
    PhabricatorUserEmail $email,
    $allow_reassign = false) {

    if ($user->getID()) {
      throw new Exception(pht('User has already been created!'));
    }

    $is_reassign = false;
    if ($email->getID()) {
      if ($allow_reassign) {
        if ($email->getIsPrimary()) {
          throw new Exception(
            pht('Primary email addresses can not be reassigned.'));
        }
        $is_reassign = true;
      } else {
        throw new Exception(pht('Email has already been created!'));
      }
    }

    if (!PhabricatorUser::validateUsername($user->getUsername())) {
      $valid = PhabricatorUser::describeValidUsername();
      throw new Exception(pht('Username is invalid! %s', $valid));
    }

    // Always set a new user's email address to primary.
    $email->setIsPrimary(1);

    // If the primary address is already verified, also set the verified flag
    // on the user themselves.

View on GitHub (pinned to 5720a38cfe)

When it happens

Trigger: Thrown at src/applications/people/editor/PhabricatorUserEditor.php:37 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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