{"record":{"id":"e22cc08b4f3e4c4a","repo":"phacility/phabricator","slug":"primary-email-addresses-can-not-be-reassigned","errorCode":null,"errorMessage":"Primary email addresses can not be reassigned.","messagePattern":"Primary email addresses can not be reassigned\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/people/editor/PhabricatorUserEditor.php","lineNumber":37,"sourceCode":"\n\n  /**\n   * @task edit\n   */\n  public function createNewUser(\n    PhabricatorUser $user,\n    PhabricatorUserEmail $email,\n    $allow_reassign = false) {\n\n    if ($user->getID()) {\n      throw new Exception(pht('User has already been created!'));\n    }\n\n    $is_reassign = false;\n    if ($email->getID()) {\n      if ($allow_reassign) {\n        if ($email->getIsPrimary()) {\n          throw new Exception(\n            pht('Primary email addresses can not be reassigned.'));\n        }\n        $is_reassign = true;\n      } else {\n        throw new Exception(pht('Email has already been created!'));\n      }\n    }\n\n    if (!PhabricatorUser::validateUsername($user->getUsername())) {\n      $valid = PhabricatorUser::describeValidUsername();\n      throw new Exception(pht('Username is invalid! %s', $valid));\n    }\n\n    // Always set a new user's email address to primary.\n    $email->setIsPrimary(1);\n\n    // If the primary address is already verified, also set the verified flag\n    // on the user themselves.","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/people/editor/PhabricatorUserEditor.php#L19-L55","documentation":"Error \"Primary email addresses can not be reassigned.\" thrown in phacility/phabricator.","triggerScenarios":"Thrown at src/applications/people/editor/PhabricatorUserEditor.php:37 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}