flowable/flowable-engine · error · FlowableException
Could not find a CmmnElement for id
Error message
Could not find a CmmnElement for id ${planItemInstance.getPlanItem().getId()} What it means
After resolving the CMMN model, getCmmnElement looks up the CmmnElement for the plan item's id in the primary case's element map. If the plan item exists at runtime but no matching CmmnElement is found in the model (and getPlanItem() is non-null), this FlowableException is thrown. Note the helper returns null silently when getPlanItem() is null, but throws when the id is not in the model.
Solutions
- Verify the case definition deployment matches the model: redeploy cleanly and restart cases so the running case uses the current model version.
- Guard the helper call: use planItemInstance.getPlanItem() null-checks and treat missing CmmnElement as optional in your delegate.
- Use CmmnDelegateHelper.getCmmnModel(planItemInstance) and inspect getAllCaseElements() keys to confirm the expected id is present.
- Check caseDefinitionId consistency (same deployment/tenant) between the running case and the resolved model.
Example fix
// before
CmmnElement el = CmmnDelegateHelper.getCmmnElement(planItemInstance); // may throw
// after
CmmnElement el = null;
if (planItemInstance.getPlanItem() != null) {
el = CmmnDelegateHelper.getCmmnModel(planItemInstance)
.getPrimaryCase().getAllCaseElements().get(planItemInstance.getPlanItem().getId());
}
if (el != null) { ... } Defensive patterns
Strategy: try-catch
Validate before calling
CmmnModel model = CmmnDelegateHelper.getCmmnModel(planItemInstance);
boolean present = planItemInstance.getPlanItem() != null
&& model.getPrimaryCase().getAllCaseElements().containsKey(planItemInstance.getPlanItem().getId()); Type guard
CmmnElement findElementOrNull(DelegatePlanItemInstance p) {
try { return CmmnDelegateHelper.getCmmnElement(p); }
catch (org.flowable.common.engine.api.FlowableException e) { return null; }
} Try / catch
try {
CmmnElement el = CmmnDelegateHelper.getCmmnElement(planItemInstance);
} catch (org.flowable.common.engine.api.FlowableException e) {
if (e.getMessage().startsWith("Could not find a CmmnElement")) { log.warn("Element missing in model: {}", e.getMessage()); el = null; }
else throw e;
} Prevention
- Keep running cases in sync with deployed model versions; avoid mutating model ids after deployment.
- Treat CmmnElement lookups as optional in delegates — some plan items may not map to case elements.
- Log the plan item id and caseDefinitionId to diagnose stale-model mismatches.
When it happens
Trigger: Custom code calls CmmnDelegateHelper.getCmmnElement(planItemInstance) while the plan item's id cannot be found in cmmnModel.getPrimaryCase().getAllCaseElements() — e.g. the deployed model version differs from the running case definition, or the id lookup fails for dynamically created/child plan items.
Common situations: Running cases against an outdated cached CMMN model after a redeploy; lookups for plan items not present as case elements (e.g. certain generated/child instances); case definition id mismatch between tenant/deployment versions.
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
- activatedBefore is null
- after time is null
- Business key is null
- Cannot aggregate overview variable
- Cannot aggregate variable
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/1ae3d43d37e4269d.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/delegate/CmmnDelegateHelper.java:61
* Returns the {@link CmmnModel} matching the case definition cmmn model for the case definition of the passed {@link DelegatePlanItemInstance}.
*/
public static CmmnModel getCmmnModel(DelegatePlanItemInstance planItemInstance) {
if (planItemInstance == null) {
throw new FlowableException("Null planItemInstance passed");
}
return CaseDefinitionUtil.getCmmnModel(planItemInstance.getCaseDefinitionId());
}
/**
* Returns the current {@link CmmnElement} where the {@link DelegatePlanItemInstance} is currently at.
*/
public static CmmnElement getCmmnElement(DelegatePlanItemInstance planItemInstance) {
CmmnModel cmmnModel = getCmmnModel(planItemInstance);
CaseElement caseElement = null;
if (planItemInstance.getPlanItem() != null) {
caseElement = cmmnModel.getPrimaryCase().getAllCaseElements().get(planItemInstance.getPlanItem().getId());
if (caseElement == null) {
throw new FlowableException("Could not find a CmmnElement for id " + planItemInstance.getPlanItem().getId());
}
}
return caseElement;
}
public static boolean isExecutingLifecycleListener(DelegatePlanItemInstance planItemInstance) {
// Need to check the lifecycle listener, not the model listener (as it could be a lifecycle listener set on the config level)
return planItemInstance.getCurrentLifecycleListener() != null;
}
public static Map<String, List<ExtensionElement>> getExtensionElements(DelegatePlanItemInstance planItemInstance) {
if (isExecutingLifecycleListener(planItemInstance)) {
return getListenerExtensionElements(planItemInstance);
} else {
return getCmmnElementExtensionElements(planItemInstance);
}
}
View on GitHub (pinned to d6d39ce1c6)