{"record":{"id":"8c95f1d2785c4198","repo":"theonedev/onedev","slug":"unable-to-send-verification-email-as-this-email-ad","errorCode":null,"errorMessage":"Unable to send verification email as this email address is already verified","messagePattern":"Unable to send verification email as this email address is already verified","errorType":"http","errorClass":"ExplicitException","httpStatus":400,"severity":"warning","filePath":"server-core/src/main/java/io/onedev/server/rest/resource/EmailAddressResource.java","lineNumber":126,"sourceCode":"\n\t\tif (!getAuthUser().equals(owner)) \n\t\t\tauditService.audit(null, \"set email address \\\"\" + emailAddress.getValue() + \"\\\" as primary in account \\\"\" + owner.getName() + \"\\\" via RESTful API\", null, null);\n\t\t\n\t\treturn emailAddressId;\n\t}\n\t\n\t@Api(order=260, description=\"Resend verification email\")\n\t@Path(\"/resend-verification-email\")\n\t@POST\n\tpublic Long resendVerificationEmail(@NotNull Long emailAddressId) {\n\t\tvar emailAddress = emailAddressService.load(emailAddressId);\n\t\tif (!SecurityUtils.isAdministrator() && !emailAddress.getOwner().equals(getAuthUser()))\n\t\t\tthrow new UnauthorizedException();\n\n\t\tif (settingService.getMailConnector() == null)\n\t\t\tthrow new ExplicitException(\"Unable to send verification email as mail service is not configured\");\n\t\tif (emailAddress.isVerified())\n\t\t\tthrow new ExplicitException(\"Unable to send verification email as this email address is already verified\");\n\t\t\n\t\temailAddressService.sendVerificationEmail(emailAddress);\n\t\t\n\t\treturn emailAddressId;\n\t}\n\t\n\t@Api(order=300)\n\t@Path(\"/{emailAddressId}\")\n\t@DELETE\n\tpublic Response deleteEmailAddress(@PathParam(\"emailAddressId\") Long emailAddressId) {\n\t\tvar emailAddress = emailAddressService.load(emailAddressId);\n\t\tif (!SecurityUtils.isAdministrator() && !emailAddress.getOwner().equals(getAuthUser())) \n\t\t\tthrow new UnauthorizedException();\n\t\t\n\t\tif (emailAddress.isPrimary() && emailAddress.getOwner().getPassword() == null) {\n\t\t\tthrow new ExplicitException(\"Cannot delete primary email address of \"\n\t\t\t\t\t+ \"externally authenticated user\");\n\t\t}","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/rest/resource/EmailAddressResource.java#L108-L144","documentation":"If the email address is already verified, resending a verification email is pointless and rejected with ExplicitException. OneDev checks emailAddress.isVerified() before dispatching another verification mail.","triggerScenarios":"POST to /resend-verification-email for an address whose isVerified() is true — e.g. user already clicked the verification link.","commonSituations":"User double-clicks resend in the UI; queued/parallel resend requests after verification; scripts retrying an already-completed flow.","solutions":["Check emailAddress.isVerified() before calling and skip if already verified","Treat this error as success in idempotent scripts (address is usable)","Clear client state that still shows the address as unverified"],"exampleFix":"// before\nresendVerificationEmail(id);\n// after\nif (!emailAddressService.load(id).isVerified()) resendVerificationEmail(id);","handlingStrategy":"validation","validationCode":"if (emailAddress.isVerified()) skip resend;","typeGuard":"boolean needsVerification = !emailAddress.isVerified();","tryCatchPattern":"try { resendVerificationEmail(id); } catch (ExplicitException e) { /* already verified: treat as success */ }","preventionTips":["Check verified status before resending","Treat this error as idempotent success in scripts","Update UI state immediately after verification"],"tags":["rest-api","email-verification","idempotency","onedev"],"backgroundTag":"invalid-state-transition","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}