flowable/flowable-engine · error · FlowableObjectNotFoundException
No case instance found for id = '
Error message
No case instance found for id = '
What it means
CaseInstanceClaimCmd.execute throws FlowableObjectNotFoundException when no case instance exists for the given id. The lookup via CaseInstanceEntityManager.findById returns null and the command reports the id with the expected entity type before any claim/identity-link changes are made.
Source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/CaseInstanceClaimCmd.java:54
private final String caseInstanceId;
private final String userId;
public CaseInstanceClaimCmd(String caseInstanceId, String userId) {
if (caseInstanceId == null || caseInstanceId.length() < 1) {
throw new FlowableIllegalArgumentException("The case instance id is mandatory, but '" + caseInstanceId + "' has not been provided.");
}
this.caseInstanceId = caseInstanceId;
this.userId = userId;
}
@Override
public Void execute(CommandContext commandContext) {
CaseInstanceEntityManager caseInstanceEntityManager = CommandContextUtil.getCaseInstanceEntityManager(commandContext);
CaseInstanceEntity caseInstanceEntity = caseInstanceEntityManager.findById(caseInstanceId);
if (caseInstanceEntity == null) {
throw new FlowableObjectNotFoundException("No case instance found for id = '" + caseInstanceId + "'.", CaseInstance.class);
}
CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
if (userId != null) {
List<IdentityLinkEntity> identityLinks = cmmnEngineConfiguration.getIdentityLinkServiceConfiguration()
.getIdentityLinkService().findIdentityLinksByScopeIdAndType(caseInstanceId, ScopeTypes.CMMN);
for (IdentityLinkEntity identityLink : identityLinks) {
if (IdentityLinkType.ASSIGNEE.equals(identityLink.getType())) {
throw new FlowableException("Case instance '" + caseInstanceId + "' is already claimed.");
}
}
IdentityLinkUtil.createCaseInstanceIdentityLink(caseInstanceEntity, userId, null, IdentityLinkType.ASSIGNEE, cmmnEngineConfiguration);
caseInstanceEntityManager.updateCaseInstanceClaimTime(caseInstanceEntity, cmmnEngineConfiguration.getClock().getCurrentTime(), userId);
if (cmmnEngineConfiguration.getCaseInstanceStateInterceptor() != null) {
cmmnEngineConfiguration.getCaseInstanceStateInterceptor().handleClaim(caseInstanceEntity, userId);View on GitHub (pinned to d6d39ce1c6)
Solutions
- Verify the id via cmmnRuntimeService.createCaseInstanceQuery().caseInstanceId(id).singleResult() before claiming
- Correct the id source — confirm it is a running case instance id
- Catch FlowableObjectNotFoundException and map it to a 404-style response for external callers
Example fix
// before
cmmnRuntimeService.claimCaseInstance(id, userId);
// after
CaseInstance ci = cmmnRuntimeService.createCaseInstanceQuery().caseInstanceId(id).singleResult();
if (ci == null) {
throw new NotFoundException("Case instance not found: " + id);
}
cmmnRuntimeService.claimCaseInstance(id, userId); Defensive patterns
Strategy: validation
Validate before calling
boolean exists = cmmnRuntimeService.createCaseInstanceQuery().caseInstanceId(caseInstanceId).count() > 0;
Try / catch
try {
cmmnRuntimeService.claimCaseInstance(caseId, userId);
} catch (FlowableObjectNotFoundException e) {
throw new NotFoundException("Case instance " + caseId + " not found");
} Prevention
- Refresh UI state before claim actions on long-lived pages
- Confirm datasource/configuration points at the same environment the id came from
- Map FlowableObjectNotFoundException to 404 responses in your API layer
When it happens
Trigger: Claiming a case instance whose id does not exist, was completed/terminated, was deleted, or contains typos/whitespace; also using a case definition id or task id instead of a case instance id.
Common situations: Stale UI references after the case was closed by another user; ids from another Flowable deployment/database (wrong datasource config); copying ids between test and production environments.
Understand the failure class
Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.
Related errors
- Cannot find case instance for id ${caseInstanceId}
- Cannot find plan item instance for id ${planItemInstanceId}
- Cannot find task with id ${taskId}
- Cannot find case instance with id
- The case instance id is mandatory, but '
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/e8e57315a8205fbe.
Report an issue: GitHub.