{"record":{"id":"ebb819d722a21271","repo":"phacility/phabricator","slug":"email-is-not-verified","errorCode":null,"errorMessage":"Email is not verified!","messagePattern":"Email is not verified!","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/people/editor/PhabricatorUserEditor.php","lineNumber":295,"sourceCode":"      throw new Exception(pht('Email has not been created yet!'));\n    }\n\n    $user->openTransaction();\n      $user->beginWriteLocking();\n\n        $user->reload();\n        $email->reload();\n\n        if ($email->getUserPHID() != $user->getPHID()) {\n          throw new Exception(pht('User does not own email!'));\n        }\n\n        if ($email->getIsPrimary()) {\n          throw new Exception(pht('Email is already primary!'));\n        }\n\n        if (!$email->getIsVerified()) {\n          throw new Exception(pht('Email is not verified!'));\n        }\n\n        $old_primary = $user->loadPrimaryEmail();\n        if ($old_primary) {\n          $old_primary->setIsPrimary(0);\n          $old_primary->save();\n        }\n\n        $email->setIsPrimary(1);\n        $email->save();\n\n        // If the user doesn't have the verified flag set on their account\n        // yet, set it. We've made sure the email is verified above. See\n        // T12635 for discussion.\n        if (!$user->getIsEmailVerified()) {\n          $user->setIsEmailVerified(1);\n          $user->save();\n        }","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/people/editor/PhabricatorUserEditor.php#L277-L313","documentation":"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.","triggerScenarios":"Thrown at src/applications/people/editor/PhabricatorUserEditor.php:295 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Have the user click the verification link sent to that address first.","Administratively verify the address, then retry the primary switch."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","contentChangedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}