flowable/flowable-engine · error · FlowableIllegalArgumentException
caseInstanceIds are null
Error message
caseInstanceIds are null
What it means
BulkTerminateCaseInstancesCmd.execute throws FlowableIllegalArgumentException when the caseInstanceIds collection is null. The command builds a deduplicated Set of ids and plans a manual terminate operation per id on the agenda; a null collection is rejected before planning begins.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/BulkTerminateCaseInstancesCmd.java:38
import org.flowable.common.engine.api.FlowableIllegalArgumentException;
import org.flowable.common.engine.impl.interceptor.Command;
import org.flowable.common.engine.impl.interceptor.CommandContext;
/**
* @author Christopher Welsch
*/
public class BulkTerminateCaseInstancesCmd implements Command<Void> {
protected Collection<String> caseInstanceIds;
public BulkTerminateCaseInstancesCmd(Collection<String> caseInstanceIds) {
this.caseInstanceIds = caseInstanceIds;
}
@Override
public Void execute(CommandContext commandContext) {
if (caseInstanceIds == null) {
throw new FlowableIllegalArgumentException("caseInstanceIds are null");
}
Set<String> instanceIdSet = new HashSet<>(caseInstanceIds);
for (String instanceId : instanceIdSet) {
CommandContextUtil.getAgenda(commandContext).planManualTerminateCaseInstanceOperation(instanceId);
}
return null;
}
}
View on GitHub (pinned to d6d39ce1c6)
Solutions
- Pass a non-null collection of case instance ids to bulkTerminateCaseInstances
- Coalesce null to an empty list at the call site
- Validate the id list before scheduling termination operations
Example fix
// before runtimeService.bulkTerminateCaseInstances(idsToTerminate); // after runtimeService.bulkTerminateCaseInstances(idsToTerminate == null ? Collections.emptyList() : idsToTerminate);
Defensive patterns
Strategy: type-guard
Validate before calling
if (idsToTerminate == null) idsToTerminate = Collections.emptyList();
Type guard
boolean isNonNullCollection(Collection<?> c) { return c != null; } Try / catch
try {
cmmnRuntimeService.bulkTerminateCaseInstances(ids);
} catch (FlowableIllegalArgumentException e) {
log.error("Bulk terminate rejected: {}", e.getMessage());
} Prevention
- Validate event payloads contain the ids field before scheduling termination
- Never pass through variables that may be null; normalize at boundaries
- Add nullness annotations/lint checks on service-layer inputs
When it happens
Trigger: Calling cmmnRuntimeService.bulkTerminateCaseInstances(null) or constructing the command with a null id collection, e.g. from an upstream batch job whose id query returned null.
Common situations: Termination workflows driven by external events where the event payload lacks the ids field; unguarded method chaining producing null; reuse of a variable cleared earlier in the flow.
Related errors
- caseInstanceIds are null
- historic case instanceIds are null
- tasks are null
- caseInstanceId is null
- variable name is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/b163965395232402.
Report an issue: GitHub.