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

  1. Validate the id first: repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult() must return a result before listing decisions
  2. Use processDefinitionKey + latest version resolution instead of raw ids stored in config
  3. Check that the deployment containing the definition was not deleted and matches the tenant
  4. 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

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


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)