{"record":{"id":"7b0e3a515b5c9a84","repo":"phacility/phabricator","slug":"email-not-owned-by-user","errorCode":null,"errorMessage":"Email not owned by user!","messagePattern":"Email not owned by user!","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/people/editor/PhabricatorUserEditor.php","lineNumber":241,"sourceCode":"\n    if (!$user->getID()) {\n      throw new Exception(pht('User has not been created yet!'));\n    }\n    if (!$email->getID()) {\n      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->getIsPrimary()) {\n          throw new Exception(pht(\"Can't remove primary email!\"));\n        }\n        if ($email->getUserPHID() != $user->getPHID()) {\n          throw new Exception(pht('Email not owned by user!'));\n        }\n\n        $destruction_engine = id(new PhabricatorDestructionEngine())\n          ->setWaitToFinalizeDestruction(true)\n          ->destroyObject($email);\n\n        $log = PhabricatorUserLog::initializeNewLog(\n          $actor,\n          $user->getPHID(),\n          PhabricatorRemoveEmailUserLogType::LOGTYPE);\n        $log->setOldValue($email->getAddress());\n        $log->save();\n\n      $user->endWriteLocking();\n    $user->saveTransaction();\n\n    $this->revokePasswordResetLinks($user);\n    $destruction_engine->finalizeDestruction();","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/people/editor/PhabricatorUserEditor.php#L223-L259","documentation":"Error \"Email not owned by user!\" thrown in phacility/phabricator.","triggerScenarios":"Thrown at src/applications/people/editor/PhabricatorUserEditor.php:241 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"}