{"record":{"id":"e17d85e218b87586","repo":"theonedev/onedev","slug":"unable-to-create-issue-from-email-as-service-desk","errorCode":null,"errorMessage":"Unable to create issue from email as service desk is not enabled","messagePattern":"Unable to create issue from email as service desk is not enabled","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/mail/DefaultMailService.java","lineNumber":476,"sourceCode":"\t\t\t\tPullRequest involvedPullRequest = null;\n\t\t\t\tCollection<InternetAddress> involvedInternetAddresses = new HashSet<>();\n\n\t\t\t\tList<InternetAddress> receiverInternetAddresses = new ArrayList<>();\n\t\t\t\treceiverInternetAddresses.addAll(asList(toInternetAddresses));\n\t\t\t\treceiverInternetAddresses.addAll(asList(getAddresses(message, \"Cc\")));\n\t\t\t\tfor (InternetAddress receiverInternetAddress : receiverInternetAddresses) {\n\t\t\t\t\tParsedEmailAddress parsedReceiverAddress = ParsedEmailAddress.parse(receiverInternetAddress.getAddress());\n\t\t\t\t\tvar project = findProject(systemAddress, parsedReceiverAddress);\n\t\t\t\t\tif (project != null) {\n\t\t\t\t\t\tif (isOriginatedFromOneDev(message)) {\n\t\t\t\t\t\t\tlogger.warn(\"Ignored opening issue from message as it is originated from OneDev\");\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tvar serviceDeskSetting = settingService.getServiceDeskSetting();\n\t\t\t\t\t\t\tif (serviceDeskSetting != null) {\n\t\t\t\t\t\t\t\tlogger.debug(\"Creating issue via email (project: {})...\", project.getPath());\n\t\t\t\t\t\t\t\tinvolvedIssue = openIssue(message, project, fromInternetAddress, fromUser, parsedSystemAddress, receiverInternetAddresses);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthrow new ExplicitException(\"Unable to create issue from email as service desk is not enabled\");\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (parsedReceiverAddress.isSubaddress() && systemAddress.equalsIgnoreCase(parsedReceiverAddress.getOriginalAddress())) {\n\t\t\t\t\t\tif (involvedIssue == null && involvedPullRequest == null) {\n\t\t\t\t\t\t\tString subAddress = StringUtils.substringAfter(parsedReceiverAddress.getName(), \"+\");\n\t\t\t\t\t\t\tif (subAddress.equals(MailService.TEST_SUB_ADDRESS)) {\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t} else if (subAddress.contains(\"~\")) {\n\t\t\t\t\t\t\t\tLong entityId;\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tentityId = Long.parseLong(StringUtils.substringAfter(subAddress, \"~\"));\n\t\t\t\t\t\t\t\t} catch (NumberFormatException e) {\n\t\t\t\t\t\t\t\t\tthrow new ExplicitException(\"Invalid id specified in recipient address: \" + parsedReceiverAddress);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif (subAddress.contains(\"issue\")) {\n\t\t\t\t\t\t\t\t\tinvolvedIssue = issueService.get(entityId);\n\t\t\t\t\t\t\t\t\tif (involvedIssue == null)\n\t\t\t\t\t\t\t\t\t\tthrow new ExplicitException(\"Non-existent issue specified in recipient address: \" + parsedReceiverAddress);","sourceCodeStart":458,"sourceCodeEnd":494,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/mail/DefaultMailService.java#L458-L494","documentation":"When an inbound email targets a project's system address without a subaddress (no issue/PR reference), OneDev tries to open a new issue via the service desk. If the project has no ServiceDeskSetting configured, handleMessage throws this ExplicitException because creating issues from email requires the service desk feature to be enabled.","triggerScenarios":"An email is sent to a project system address; the project is resolved but serviceDeskSetting is null and the message is not a reply to an existing issue or pull request.","commonSituations":"User emails a project address expecting an issue to be created, but the admin never enabled Service Desk for that project; service desk disabled after previously being on.","solutions":["Enable service desk for the target project (Project -> Service Desk setting) in OneDev admin/project settings.","Send the email to an existing issue's subaddress instead (issue~<id>@...).","Reply to an existing issue/PR thread so the message is associated rather than creating a new issue."],"exampleFix":"// project setting: enable service desk\n// before: no serviceDeskSetting for project\n// after: set Setting.getServiceDeskSetting() via ProjectServiceDeskSetting with mailbox configured","handlingStrategy":"validation","validationCode":"var sd = settingService.getServiceDeskSetting();\nif (sd == null) throw new IllegalStateException(\"Enable service desk before emailing this project address\");","typeGuard":null,"tryCatchPattern":"try { mailHandler.handle(message); } catch (ExplicitException e) { mailService.sendMail(from, ..., \"Could not process your email: \" + e.getMessage(), ...); }","preventionTips":["Enable service desk for projects that receive email","Document the project email address only when the feature is on","Reply to existing issue threads when unsure"],"tags":["email","service-desk","onedev"],"backgroundTag":"feature-not-enabled","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"}