flowable/flowable-engine · error · FlowableIllegalArgumentException

error is null

Error message

error is null

What it means

The HandleCaseTaskErrorCmd constructor throws FlowableIllegalArgumentException("error is null") when the BusinessError argument is null. The command exists solely to propagate a business error into the case execution, so a null error makes the operation undefined.

Solutions

  1. Ensure a non-null BusinessError instance is built before constructing the command.
  2. Make the error-code-to-BusinessError mapping fail loudly (throw) instead of returning null for unknown codes.
  3. Validate the inbound payload so error details are always present when error propagation is triggered.
  4. Catch FlowableIllegalArgumentException and log/report the missing business error context.

Example fix

// before
BusinessError err = errorRegistry.get(code); // may be null
managementService.executeCommand(new HandleCaseTaskErrorCmd(executionId, err));
// after
BusinessError err = errorRegistry.get(code);
if (err == null) {
    throw new IllegalArgumentException("Unknown business error code: " + code);
}
managementService.executeCommand(new HandleCaseTaskErrorCmd(executionId, err));
Defensive patterns

Strategy: validation

Validate before calling

if (error == null) {
    throw new IllegalArgumentException("BusinessError must be provided for error propagation");
}

Type guard

boolean hasBusinessError(BusinessError e) { return e != null; }

Try / catch

try {
    managementService.executeCommand(new HandleCaseTaskErrorCmd(executionId, error));
} catch (FlowableIllegalArgumentException e) {
    throw new BadRequestException("BusinessError is required: " + e.getMessage(), e);
}

Prevention

When it happens

Trigger: new HandleCaseTaskErrorCmd(executionId, null) — e.g. the BusinessError was parsed from an event payload that lacked error details, or a factory returned null on unknown error codes.

Common situations: Mapping an inbound error code to a BusinessError via a registry that misses the code and returns null; deserialization of error payloads producing null; test scaffolding omitting the error.

Related errors


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

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/HandleCaseTaskErrorCmd.java:47

 * by propagating it as a BPMN error on the parent CaseTask execution.
 * The full BusinessError is passed through so that error data (code, message,
 * additional data) is preserved for boundary error event variable mapping.
 *
 * @author Joram Barrez
 */
public class HandleCaseTaskErrorCmd implements Command<Void>, Serializable {

    private static final long serialVersionUID = 1L;

    protected String executionId;
    protected BusinessError error;

    public HandleCaseTaskErrorCmd(String executionId, BusinessError error) {
        if (executionId == null) {
            throw new FlowableIllegalArgumentException("executionId is null");
        }
        if (error == null) {
            throw new FlowableIllegalArgumentException("error is null");
        }
        this.executionId = executionId;
        this.error = error;
    }

    @Override
    public Void execute(CommandContext commandContext) {
        ProcessEngineConfigurationImpl processEngineConfiguration = CommandContextUtil.getProcessEngineConfiguration(commandContext);
        ExecutionEntity execution = (ExecutionEntity) processEngineConfiguration.getExecutionEntityManager().findById(executionId);
        if (execution == null) {
            throw new FlowableException("No execution could be found for id " + executionId);
        }

        ErrorPropagation.propagateError(error, execution);
        return null;
    }
}

View on GitHub (pinned to d6d39ce1c6)