flowable/flowable-engine · error · FlowableObjectNotFoundException
Cannot find process definition for id
Error message
Cannot find process definition for id: ${processDefinitionId} What it means
GetDecisionsForProcessDefinitionCmd lists DMN decisions referenced by a process definition. It resolves the definition via ProcessDefinitionUtil; if null it throws FlowableObjectNotFoundException with the id in the message. The process definition id is valid syntactically but no such definition exists (or was removed), so no decision list can be derived.
Solutions
- Validate the id first: repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult() must return a result before listing decisions
- Use processDefinitionKey + latest version resolution instead of raw ids stored in config
- Check that the deployment containing the definition was not deleted and matches the tenant
- Cache process definition ids only in sync with deployment events
Example fix
// before
List<DmnDecision> ds = runtimeService.getDecisionsForProcessDefinition(defId); // defId may be stale
// after
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(defId).singleResult();
if (pd != null) {
List<DmnDecision> ds = runtimeService.getDecisionsForProcessDefinition(defId);
} Defensive patterns
Strategy: validation
Validate before calling
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(defId).singleResult(); if (pd == null) return Collections.emptyList(); List<DmnDecision> ds = runtimeService.getDecisionsForProcessDefinition(defId);
Try / catch
try {
List<DmnDecision> ds = runtimeService.getDecisionsForProcessDefinition(defId);
} catch (FlowableObjectNotFoundException e) {
// definition removed or wrong tenant
} Prevention
- Resolve definitions by key/latest version rather than stored raw ids
- Listen to deployment/delete events to invalidate cached definition ids
- Scope ids to the correct tenant and engine
When it happens
Trigger: managementService/TaskService-level API getDecisionsForProcessDefinition(processDefinitionId) with an unknown id; an id from a definition deleted via deleteDeployment; ids referencing a different tenant/engine scope where the definition isn't visible.
Common situations: Environments with multiple tenants passing ids across tenant boundaries; cleanup jobs deleting deployments while caches hold old ids; hand-written ids in tests/config.
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 definition for id:
- Cannot find process definition for key
- Cannot find process definition with id " +…
- Cannot find process definition with id
- Cannot find process definition with id
AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11).
Data as JSON: /api/errors/4feadd49d977f522.
Report an issue: GitHub.
Appendix: source
Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetDecisionsForProcessDefinitionCmd.java:55
/**
* @author Yvo Swillens
*/
public class GetDecisionsForProcessDefinitionCmd implements Command<List<DmnDecision>>, Serializable {
private static final long serialVersionUID = 1L;
protected String processDefinitionId;
protected DmnRepositoryService dmnRepositoryService;
public GetDecisionsForProcessDefinitionCmd(String processDefinitionId) {
this.processDefinitionId = processDefinitionId;
}
@Override
public List<DmnDecision> execute(CommandContext commandContext) {
ProcessDefinition processDefinition = ProcessDefinitionUtil.getProcessDefinition(processDefinitionId);
if (processDefinition == null) {
throw new FlowableObjectNotFoundException("Cannot find process definition for id: " + processDefinitionId, ProcessDefinition.class);
}
BpmnModel bpmnModel = ProcessDefinitionUtil.getBpmnModel(processDefinitionId);
if (bpmnModel == null) {
throw new FlowableObjectNotFoundException("Cannot find bpmn model for process definition id: " + processDefinitionId, BpmnModel.class);
}
if (CommandContextUtil.getDmnRepositoryService() == null) {
throw new FlowableException("DMN repository service is not available");
}
dmnRepositoryService = CommandContextUtil.getDmnRepositoryService();
List<DmnDecision> decisions = getDecisionsFromModel(bpmnModel, processDefinition);
return decisions;
}
View on GitHub (pinned to d6d39ce1c6)