flowable/flowable-engine · error · FlowableIllegalArgumentException
caseInstanceId is null
Error message
caseInstanceId is null
What it means
RemoveVariablesCmd removes multiple variables from a CMMN case instance and first validates its inputs. A null caseInstanceId cannot identify a target case, so it throws FlowableIllegalArgumentException immediately.
Solutions
- Guard the id for null before calling
- Obtain the id from a freshly created case instance rather than a nullable field
- Fail fast in your API layer with a 400 when the id parameter is missing
Example fix
// before cmmnRuntimeService.removeVariables(caseInstanceId, names); // after Objects.requireNonNull(caseInstanceId, "caseInstanceId must not be null"); cmmnRuntimeService.removeVariables(caseInstanceId, names);
Defensive patterns
Strategy: validation
Validate before calling
if (caseInstanceId == null) throw new IllegalArgumentException("caseInstanceId is required"); Try / catch
try { cmmnRuntimeService.removeVariables(id, names); } catch (FlowableIllegalArgumentException e) { log.error("Invalid input: {}", e.getMessage()); } Prevention
- Enforce non-null id parameters in service wrappers
- Validate path/request parameters at the controller layer
- Create ids only via engine start-case return values
When it happens
Trigger: Invoking removeVariables(null, names) via the RuntimeService API, e.g. when an optional path/id parameter was not supplied and forwarded as null.
Common situations: REST endpoints with missing id path param; lookup methods returning null that is passed on; test setups forgetting to set the id field.
Related errors
- caseInstanceId is null
- caseInstanceId is null
- caseInstanceId is null
- caseInstanceId is null
- caseInstanceId is null
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/a18370f1733f4461.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/RemoveVariablesCmd.java:40
import org.flowable.common.engine.impl.interceptor.CommandContext;
/**
* @author Tijs Rademakers
*/
public class RemoveVariablesCmd implements Command<Void> {
protected String caseInstanceId;
protected Collection<String> variableNames;
public RemoveVariablesCmd(String caseInstanceId, Collection<String> variableNames) {
this.caseInstanceId = caseInstanceId;
this.variableNames = variableNames;
}
@Override
public Void execute(CommandContext commandContext) {
if (caseInstanceId == null) {
throw new FlowableIllegalArgumentException("caseInstanceId is null");
}
if (variableNames == null) {
throw new FlowableIllegalArgumentException("variableNames is null");
}
CaseInstanceEntity caseInstanceEntity = CommandContextUtil.getCaseInstanceEntityManager(commandContext).findById(caseInstanceId);
if (caseInstanceEntity == null) {
throw new FlowableObjectNotFoundException("No case instance found for id " + caseInstanceId, CaseInstanceEntity.class);
}
caseInstanceEntity.removeVariables(variableNames);
return null;
}
}
View on GitHub (pinned to d6d39ce1c6)