flowable/flowable-engine · error · FlowableObjectNotFoundException

Cannot find bpmn model for process definition id: ${processD

Error message

Cannot find bpmn model for process definition id: ${processDefinitionId}

What it means

GetFormDefinitionsForProcessDefinitionCmd resolves the BPMN model for a deployed process definition via ProcessDefinitionUtil.getBpmnModel. The engine throws FlowableObjectNotFoundException when that lookup returns null, meaning the definition exists in the command context but no BPMN XML model can be resolved for it. This is a lookup failure, not a user-input validation error.

Source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/cmd/GetFormDefinitionsForProcessDefinitionCmd.java:62

    protected String processDefinitionId;
    protected FormRepositoryService formRepositoryService;

    public GetFormDefinitionsForProcessDefinitionCmd(String processDefinitionId) {
        this.processDefinitionId = processDefinitionId;
    }

    @Override
    public List<FormDefinition> 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.getFormRepositoryService() == null) {
            throw new FlowableException("Form repository service is not available");
        }

        formRepositoryService = CommandContextUtil.getFormRepositoryService();
        List<FormDefinition> formDefinitions = getFormDefinitionsFromModel(bpmnModel, processDefinition);

        return formDefinitions;
    }

    protected List<FormDefinition> getFormDefinitionsFromModel(BpmnModel bpmnModel, ProcessDefinition processDefinition) {
        Set<String> formKeys = new HashSet<>();
        List<FormDefinition> formDefinitions = new ArrayList<>();

        // for all start events
        List<StartEvent> startEvents = bpmnModel.getMainProcess().findFlowElementsOfType(StartEvent.class, true);

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Verify the processDefinitionId exists via repositoryService.createProcessDefinitionQuery().processDefinitionId(id).singleResult() before calling the form lookup.
  2. Confirm the deployment still contains its BPMN XML resource (check ACT_GE_BYTEARRAY / deployment resources); if purged, redeploy the process definition.
  3. Ensure you are passing a process definition id, not a form/case/app definition id or task definition key.
  4. Check that the command runs against the same engine/database that holds the definition.

Example fix

// before
List<FormDefinition> forms = formRepositoryService.getFormDefinitionsForProcessDefinition(processDefinitionId);
// after
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery()
    .processDefinitionId(processDefinitionId).singleResult();
if (pd == null) {
    throw new IllegalArgumentException("Unknown process definition: " + processDefinitionId);
}
List<FormDefinition> forms = formRepositoryService.getFormDefinitionsForProcessDefinition(processDefinitionId);
Defensive patterns

Strategy: try-catch

Validate before calling

ProcessDefinition pd = repositoryService.createProcessDefinitionQuery()
    .processDefinitionId(processDefinitionId).singleResult();
if (pd == null) { throw new IllegalArgumentException("Unknown process definition: " + processDefinitionId); }

Try / catch

try {
    return formRepositoryService.getFormDefinitionsForProcessDefinition(processDefinitionId);
} catch (FlowableObjectNotFoundException e) {
    log.warn("No BPMN model for definition {}: {}", processDefinitionId, e.getMessage());
    return Collections.emptyList();
}

Prevention

When it happens

Trigger: Executing GetFormDefinitionsForProcessDefinitionCmd with a processDefinitionId whose process definition cannot be resolved to a BpmnModel — e.g. the id points to a definition deployed without BPMN XML resources, the deployment was cleaned from ACT_GE_BYTEARRAY, or a form-related definition id (from another engine/module) is passed instead of a process definition id.

Common situations: Mixed form-engine setups where the form repository service is deployed with its own definitions; stale ids after redeploying or purging the database; passing an app-definition or case-definition id; using a definition from a different database schema than the one the command runs against.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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