{"record":{"id":"579c330555c3ef6a","repo":"theonedev/onedev","slug":"non-existent-pull-request-specified-in-recipient-a","errorCode":null,"errorMessage":"Non-existent pull request specified in recipient address: ","messagePattern":"Non-existent pull request specified in recipient address: ","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/mail/DefaultMailService.java","lineNumber":532,"sourceCode":"\t\t\t\t\t\t\t\t\t\t\t\tsubject, htmlBody, textBody, null, null, threadingReferences);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tif (fromUser != null) {\n\t\t\t\t\t\t\t\t\t\t\tif (SecurityUtils.canAccessIssue(fromUser.asSubject(), involvedIssue))\t\n\t\t\t\t\t\t\t\t\t\t\t\taddComment(involvedIssue, message, fromInternetAddress, fromUser, receiverInternetAddresses);\n\t\t\t\t\t\t\t\t\t\t\telse \n\t\t\t\t\t\t\t\t\t\t\t\tthrow new UnauthorizedException(\"No permission to comment issue: \" + involvedIssue.getReference());\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tif (involvedIssue.getExternalParticipants().contains(fromInternetAddress)) \t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\taddComment(involvedIssue, message, fromInternetAddress, null, receiverInternetAddresses);\n\t\t\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t\t\tthrow new UnauthorizedException(\"Not eligible to comment issue: \" + involvedIssue.getReference());\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else if (subAddress.contains(\"pullrequest\")) {\n\t\t\t\t\t\t\t\t\tif (fromUser != null) {\n\t\t\t\t\t\t\t\t\t\tinvolvedPullRequest = pullRequestService.get(entityId);\n\t\t\t\t\t\t\t\t\t\tif (involvedPullRequest == null)\n\t\t\t\t\t\t\t\t\t\t\tthrow new ExplicitException(\"Non-existent pull request specified in recipient address: \" + parsedReceiverAddress);\n\t\t\t\t\t\t\t\t\t\tif (subAddress.contains(\"unsubscribe\")) {\n\t\t\t\t\t\t\t\t\t\t\tPullRequestWatch watch = pullRequestWatchService.find(involvedPullRequest, fromUser);\n\t\t\t\t\t\t\t\t\t\t\tif (watch != null) \n\t\t\t\t\t\t\t\t\t\t\t\twatch.setWatching(false);\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\tString subject = \"Unsubscribed successfully from pull request \" + involvedPullRequest.getReference().toString(null);\n\n\t\t\t\t\t\t\t\t\t\t\tString template = StringUtils.join(settingService.getEmailTemplates().getPullRequestNotificationUnsubscribed(), \"\\n\");\n\t\t\t\t\t\t\t\t\t\t\tMap<String, Object> bindings = new HashMap<>();\n\t\t\t\t\t\t\t\t\t\t\tbindings.put(\"pullRequest\", involvedPullRequest);\n\t\t\t\t\t\t\t\t\t\t\tString htmlBody = EmailTemplates.evalTemplate(true, template, bindings);\n\t\t\t\t\t\t\t\t\t\t\tString textBody = EmailTemplates.evalTemplate(false, template, bindings);\n\t\t\t\t\t\t\t\t\t\t\tvar threadingReferences = getThreadingReferences(UUID.randomUUID().toString(), getMessageId(message));\n\t\t\t\t\t\t\t\t\t\t\tsendMailAsync(newArrayList(fromInternetAddress.getAddress()), newArrayList(), newArrayList(),\n\t\t\t\t\t\t\t\t\t\t\t\t\tsubject, htmlBody, textBody, null, null, threadingReferences);\n\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\tif (!SecurityUtils.canReadCode(involvedPullRequest.getProject())) {\n\t\t\t\t\t\t\t\t\t\t\t\taddComment(involvedPullRequest, message, fromInternetAddress, fromUser, receiverInternetAddresses);","sourceCodeStart":514,"sourceCodeEnd":550,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/mail/DefaultMailService.java#L514-L550","documentation":"Similar to the issue case: for pullrequest~<id> subaddresses, if pullRequestService.get(entityId) returns null (no pull request with that id), an ExplicitException 'Non-existent pull request specified in recipient address: <address>' is thrown.","triggerScenarios":"Email sent to pullrequest~<id>@... where the numeric id does not correspond to an existing pull request.","commonSituations":"Address copied from another OneDev instance; pull request deleted; typo in the id; stale saved mail filter/template.","solutions":["Verify the pull request id exists and fix the recipient address.","Copy the PR's email address from the pull request page in OneDev.","If the PR was deleted, operate on a different PR or contact maintainers via the project address."],"exampleFix":"// before\nTo: pullrequest~7777@company.onedev.io  (no such PR)\n// after\nTo: pullrequest~15@company.onedev.io","handlingStrategy":"validation","validationCode":"PullRequest pr = pullRequestService.get(id);\nif (pr == null) throw new IllegalArgumentException(\"No pull request with id \" + id);","typeGuard":null,"tryCatchPattern":"try { handleMessage(message); } catch (ExplicitException e) { sendFailureNotice(from, e.getMessage()); }","preventionTips":["Copy PR addresses from the PR page","Confirm the PR exists before emailing","Avoid hardcoding PR ids in automations"],"tags":["email","subaddress","entity-not-found"],"backgroundTag":"entity-not-found","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}