flowable/flowable-engine · error · FlowableException

No recipient could be found for sending email for " + variab

Error message

No recipient could be found for sending email for " + variableContainer

What it means

BaseMailActivityDelegate.createMessage builds the mail message from the mail activity's field injections (to, cc, bcc expressions). If after evaluating all recipient expressions the to, cc, and bcc lists are all empty, it throws FlowableException because an email without any recipient cannot be sent.

Source

Thrown at modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/mail/BaseMailActivityDelegate.java:109

    protected MailMessage createMessage(V variableContainer) {

        String headersStr = getStringFromField(headers, variableContainer);
        Collection<String> toList = parseRecipients(to, variableContainer);
        String fromStr = getStringFromField(from, variableContainer);
        Collection<String> ccList = parseRecipients(cc, variableContainer);
        Collection<String> bccList = parseRecipients(bcc, variableContainer);
        String subjectStr = getStringFromField(subject, variableContainer);
        String textStr = textVar == null ?
                getStringFromField(text, variableContainer) :
                getStringFromField(getExpression(variableContainer, textVar), variableContainer);
        String htmlStr = htmlVar == null ?
                getStringFromField(html, variableContainer) :
                getStringFromField(getExpression(variableContainer, htmlVar), variableContainer);
        String charSetStr = getStringFromField(charset, variableContainer);

        if (toList.isEmpty() && ccList.isEmpty() && bccList.isEmpty()) {
            throw new FlowableException("No recipient could be found for sending email for " + variableContainer);
        }

        if (htmlStr == null && textStr == null) {
            throw new FlowableIllegalArgumentException("'html' or 'text' is required to be defined when using the mail activity");
        }

        MailMessage message = new MailMessage();

        addHeader(message, headersStr);
        message.setTo(toList);
        message.setFrom(fromStr);
        message.setCc(ccList);
        message.setBcc(bccList);
        message.setSubject(subjectStr);
        message.setPlainContent(textStr);
        message.setHtmlContent(htmlStr);
        if (charSetStr != null) {
            message.setCharset(Charset.forName(charSetStr));

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Set the 'to' field (or toVar/to expression) on the mail activity with a valid address or non-empty variable
  2. Verify at runtime that the recipient process variables are populated before the mail task executes
  3. If recipients are optional by design, guard the mail task with a condition or default recipient

Example fix

<!-- before -->
<flowable:field name="to" expression="${recipientEmail}"/>
<!-- after: ensure variable exists or provide fallback -->
<flowable:field name="to" expression="${recipientEmail != null ? recipientEmail : 'default@example.com'}"/>
Defensive patterns

Strategy: validation

Validate before calling

String to = (String) variableContainer.getVariable("recipientEmail");
if (to == null || to.isBlank()) throw new IllegalStateException("Mail task requires a non-empty recipient before reaching mail activity");

Try / catch

try { createMessage(...); } catch (FlowableException e) { if (e.getMessage().startsWith("No recipient could be found")) { logger.error("Mail task missing recipients: {}", variableContainer.getVariables()); } throw e; }

Prevention

When it happens

Trigger: A mail task/service with no 'to' field defined; 'to' configured via an expression/variable that evaluates to null or empty string at runtime (missing process variable, empty collection in toVar).

Common situations: BPMN mail task relying on a process variable for recipients that was never set; variables containing empty strings or empty lists; copy-pasted mail task template missing recipient fields.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/f5541b5cf1fee8cd. Report an issue: GitHub.