phacility/phabricator · error · Exception

Email is not verified!

Error message

Email is not verified!

What it means

Fires inside the locked section of changePrimaryEmail when the email address has not completed verification. Switching primary to an unverified address is forbidden; the check runs under write locking after ownership is confirmed, and aborts the transaction before the old primary is demoted.

Solutions

  1. Have the user click the verification link sent to that address first.
  2. Administratively verify the address, then retry the primary switch.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/applications/people/editor/PhabricatorUserEditor.php:295 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/ebb819d722a21271. Report an issue: GitHub.

Appendix: source

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

      throw new Exception(pht('Email has not been created yet!'));
    }

    $user->openTransaction();
      $user->beginWriteLocking();

        $user->reload();
        $email->reload();

        if ($email->getUserPHID() != $user->getPHID()) {
          throw new Exception(pht('User does not own email!'));
        }

        if ($email->getIsPrimary()) {
          throw new Exception(pht('Email is already primary!'));
        }

        if (!$email->getIsVerified()) {
          throw new Exception(pht('Email is not verified!'));
        }

        $old_primary = $user->loadPrimaryEmail();
        if ($old_primary) {
          $old_primary->setIsPrimary(0);
          $old_primary->save();
        }

        $email->setIsPrimary(1);
        $email->save();

        // If the user doesn't have the verified flag set on their account
        // yet, set it. We've made sure the email is verified above. See
        // T12635 for discussion.
        if (!$user->getIsEmailVerified()) {
          $user->setIsEmailVerified(1);
          $user->save();
        }

View on GitHub (pinned to 5720a38cfe)