flowable/flowable-engine · error · FlowableObjectNotFoundException

Cannot find case definition for id:

Error message

Cannot find case definition for id: 

What it means

GetFormDefinitionsForCaseDefinitionCmd resolves the CaseDefinition via CaseDefinitionUtil before extracting form definitions from the case model. A null case definition raises FlowableObjectNotFoundException with the caseDefinitionId, typed to CaseDefinition.class.

Source

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

/**
 * @author Tijs Rademakers
 */
public class GetFormDefinitionsForCaseDefinitionCmd implements Command<List<FormDefinition>>, Serializable {

    private static final long serialVersionUID = 1L;
    protected String caseDefinitionId;
    protected FormRepositoryService formRepositoryService;

    public GetFormDefinitionsForCaseDefinitionCmd(String caseDefinitionId) {
        this.caseDefinitionId = caseDefinitionId;
    }

    @Override
    public List<FormDefinition> execute(CommandContext commandContext) {
        CaseDefinition caseDefinition = CaseDefinitionUtil.getCaseDefinition(caseDefinitionId);
        
        if (caseDefinition == null) {
            throw new FlowableObjectNotFoundException("Cannot find case definition for id: " + caseDefinitionId, CaseDefinition.class);
        }
        
        Case caseModel = CaseDefinitionUtil.getCase(caseDefinitionId);

        if (caseModel == null) {
            throw new FlowableObjectNotFoundException("Cannot find case definition for id: " + caseDefinitionId, Case.class);
        }

        formRepositoryService = CommandContextUtil.getFormEngineConfiguration(commandContext).getFormRepositoryService();

        if (formRepositoryService == null) {
            throw new FlowableException("Form repository service is not available");
        }

        List<FormDefinition> formDefinitions = getFormDefinitionsFromModel(caseModel, caseDefinition);

        return formDefinitions;
    }

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Verify the id with cmmnRepositoryService.createCaseDefinitionQuery().caseDefinitionId(id).singleResult()
  2. List case definitions and use a returned id
  3. Check tenant filtering if definitions are tenant-scoped

Example fix

// before
List<FormDefinition> defs = getFormDefinitionsForCaseDefinition(caseDefinitionId); // unknown id
// after
CaseDefinition cd = cmmnRepositoryService.createCaseDefinitionQuery().caseDefinitionId(caseDefinitionId).singleResult();
if (cd != null) {
    List<FormDefinition> defs = getFormDefinitionsForCaseDefinition(caseDefinitionId);
}
Defensive patterns

Strategy: validation

Validate before calling

boolean exists = cmmnRepositoryService.createCaseDefinitionQuery().caseDefinitionId(caseDefinitionId).count() > 0;

Try / catch

try { return formDefinitionsForCaseDefinition(id); } catch (FlowableObjectNotFoundException e) { log.warn("Unknown case definition {}", id); return Collections.emptyList(); }

Prevention

When it happens

Trigger: Calling the command (e.g. via form retrieval paths for a case definition) with a caseDefinitionId that does not exist in ACT_CMMN_CASEDEF.

Common situations: Using a BPMN process definition id here; stale definition id after redeploy or DB reset; tenant-specific lookup missing the row for that tenant.

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/94c3b10511b5c7c3. Report an issue: GitHub.