flowable/flowable-engine · error · FlowableObjectNotFoundException

Cannot find case instance with id

Error message

Cannot find case instance with id 

What it means

GetEntityLinkChildrenWithSameRootAsCaseInstanceCmd verifies the case instance exists before querying entity links sharing the same root scope. A missing case instance raises FlowableObjectNotFoundException with the id, typed to CaseInstanceEntity.class.

Source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/cmd/GetEntityLinkChildrenWithSameRootAsCaseInstanceCmd.java:45

/**
 * @author Filip Hrisafov
 */
public class GetEntityLinkChildrenWithSameRootAsCaseInstanceCmd implements Command<List<EntityLink>> {
    
    protected String caseInstanceId;

    public GetEntityLinkChildrenWithSameRootAsCaseInstanceCmd(String caseInstanceId) {
        this.caseInstanceId = caseInstanceId;
    }

    @Override
    public List<EntityLink> execute(CommandContext commandContext) {
        CmmnEngineConfiguration cmmnEngineConfiguration = CommandContextUtil.getCmmnEngineConfiguration(commandContext);
        CaseInstance caseInstance = cmmnEngineConfiguration.getCaseInstanceEntityManager().findById(caseInstanceId);

        if (caseInstance == null) {
            throw new FlowableObjectNotFoundException("Cannot find case instance with id " + caseInstanceId, CaseInstanceEntity.class);
        }

        return cmmnEngineConfiguration.getEntityLinkServiceConfiguration().getEntityLinkService()
                .findEntityLinksWithSameRootScopeForScopeIdAndScopeType(caseInstanceId, ScopeTypes.CMMN, EntityLinkType.CHILD);
    }

}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Check case instance existence with a CaseInstanceQuery before the call
  2. Confirm the id belongs to the CMMN engine and the same database
  3. Persist the id at case start time rather than reconstructing it

Example fix

// before
List<EntityLink> links = cmmnRuntimeService.getEntityLinkChildrenWithSameRootAsCaseInstance(id);
// after
CaseInstance ci = cmmnRuntimeService.createCaseInstanceQuery().caseInstanceId(id).singleResult();
if (ci != null) {
    List<EntityLink> links = cmmnRuntimeService.getEntityLinkChildrenWithSameRootAsCaseInstance(id);
}
Defensive patterns

Strategy: validation

Validate before calling

CaseInstance ci = cmmnRuntimeService.createCaseInstanceQuery().caseInstanceId(caseInstanceId).singleResult();
boolean exists = ci != null;

Try / catch

try { return cmmnRuntimeService.getEntityLinkChildrenWithSameRootAsCaseInstance(id); } catch (FlowableObjectNotFoundException e) { return Collections.emptyList(); }

Prevention

When it happens

Trigger: Calling cmmnRuntimeService.getEntityLinkChildrenWithSameRootAsCaseInstance(caseInstanceId) with an unknown, deleted, or wrong-engine id.

Common situations: Cross-referencing ids from a BPMN-only application; case data purged by history cleanup; id from a different database schema.

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


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