flowable/flowable-engine · error · FlowableIllegalArgumentException
You need to provide the case instance id in order to set…
Error message
You need to provide the case instance id in order to set its name
What it means
SetCaseInstanceNameCmd.execute validates that a caseInstanceId was supplied; if it is null, FlowableIllegalArgumentException is thrown with the message 'You need to provide the case instance id in order to set its name'. This prevents issuing a name update with no target entity.
Solutions
- Provide a non-null caseInstanceId to setCaseInstanceName
- Add an explicit null check in your own code before calling the API
- Trace where the id becomes null (unbound parameter, failed lookup upstream) and fix the source
Example fix
// before cmmnRuntimeService.setCaseInstanceName(caseInstanceId, newName); // caseInstanceId may be null // after Objects.requireNonNull(caseInstanceId, "caseInstanceId is required"); cmmnRuntimeService.setCaseInstanceName(caseInstanceId, newName);
Defensive patterns
Strategy: validation
Validate before calling
if (caseInstanceId == null) {
throw new IllegalArgumentException("caseInstanceId is required to set the case name");
} Type guard
boolean hasId(String id) { return id != null && !id.isEmpty(); } Try / catch
try {
cmmnRuntimeService.setCaseInstanceName(caseInstanceId, name);
} catch (FlowableIllegalArgumentException e) {
throw new BadRequestException(e.getMessage(), e);
} Prevention
- Null-check ids at service boundaries before engine calls
- Use Objects.requireNonNull for programmer-error nulls
- Ensure upstream lookups propagate non-null ids or fail early
When it happens
Trigger: Calling CmmnRuntimeService.setCaseInstanceName(null, caseName).
Common situations: A variable holding the id was never populated; a caller chain lost the id between service layers; optional request fields left null and passed straight through.
Related errors
- Business status is null
- Case definition keys is null
- caseInstanceId is required
- caseInstanceId is required
- caseInstanceId is required
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/bb5c89035ea35716.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/SetCaseInstanceNameCmd.java:40
/**
* A command to set or change the name of a case instance.
*
* @author Micha Kiener
*/
public class SetCaseInstanceNameCmd implements Command<Void> {
protected String caseInstanceId;
protected String caseName;
public SetCaseInstanceNameCmd(String caseInstanceId, String caseName) {
this.caseInstanceId = caseInstanceId;
this.caseName = caseName;
}
@Override
public Void execute(CommandContext commandContext) {
if (caseInstanceId == null) {
throw new FlowableIllegalArgumentException("You need to provide the case instance id in order to set its name");
}
CaseInstanceEntity caseInstanceEntity = CommandContextUtil.getCaseInstanceEntityManager(commandContext).findById(caseInstanceId);
if (caseInstanceEntity == null) {
throw new FlowableObjectNotFoundException("No case instance found for id " + caseInstanceId, CaseInstanceEntity.class);
}
caseInstanceEntity.setName(caseName);
CommandContextUtil.getCmmnHistoryManager().recordUpdateCaseInstanceName(caseInstanceEntity, caseName);
return null;
}
}
View on GitHub (pinned to d6d39ce1c6)