flowable/flowable-engine · error · FlowableIllegalArgumentException

Invalid case definition id : null

Error message

Invalid case definition id : null

What it means

findDeployedCaseDefinitionById resolves a case definition by its id, first from the definition cache and then from the database. A null id cannot be looked up, so the manager immediately throws FlowableIllegalArgumentException. This is a defensive precondition check before any cache or persistence access.

Solutions

  1. Ensure the caller supplies a non-null case definition id before invoking the API
  2. Check where the id originates (process variable, request body) and fail fast with your own validation message
  3. If id is optional in your flow, guard with a null check and skip the lookup

Example fix

// before
caseDefinition = cmmnRuntimeService.getCaseDefinition(caseDefinitionId); // caseDefinitionId is null
// after
if (caseDefinitionId != null) {
    caseDefinition = cmmnRuntimeService.getCaseDefinition(caseDefinitionId);
}
Defensive patterns

Strategy: validation

Validate before calling

if (caseDefinitionId == null || caseDefinitionId.isBlank()) throw new IllegalArgumentException("caseDefinitionId required");

Try / catch

try { def = cmmnRuntimeService.getCaseDefinition(id); } catch (FlowableIllegalArgumentException e) { /* null id — fix caller */ }

Prevention

When it happens

Trigger: Passing null as caseDefinitionId to CmmnRuntimeService/Management/TaskService methods such as getCaseDefinition, getCmmnModel, or internal caseDefinition(...) resolution when the id variable was never populated.

Common situations: A variable or DTO field holding the definition id left null because a case was never started; a mapping bug where the wrong request field is read; deserialization producing null for the id.

Related errors


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

Appendix: source

Thrown at modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/deployer/CmmnDeploymentManager.java:60

    protected DeploymentCache<CaseDefinitionCacheEntry> caseDefinitionCache;
    protected List<EngineDeployer> deployers;
    protected CmmnEngineConfiguration cmmnEngineConfiguration;
    protected CmmnDeploymentEntityManager deploymentEntityManager;
    protected CaseDefinitionEntityManager caseDefinitionEntityManager;

    public void deploy(EngineDeployment deployment) {
        deploy(deployment, null);
    }

    public void deploy(EngineDeployment deployment, Map<String, Object> deploymentSettings) {
        for (EngineDeployer deployer : deployers) {
            deployer.deploy(deployment, deploymentSettings);
        }
    }

    public CaseDefinition findDeployedCaseDefinitionById(String caseDefinitionId) {
        if (caseDefinitionId == null) {
            throw new FlowableIllegalArgumentException("Invalid case definition id : null");
        }

        CaseDefinitionCacheEntry cacheEntry = caseDefinitionCache.get(caseDefinitionId);
        CaseDefinition caseDefinition = cacheEntry != null ? cacheEntry.getCaseDefinition() : null;

        if (caseDefinition == null) {
            caseDefinition = caseDefinitionEntityManager.findById(caseDefinitionId);
            if (caseDefinition == null) {
                throw new FlowableObjectNotFoundException("no deployed case definition found with id '" + caseDefinitionId + "'", CaseDefinition.class);
            }
            caseDefinition = resolveCaseDefinition(caseDefinition).getCaseDefinition();
        }
        return caseDefinition;
    }

    public CaseDefinition findDeployedLatestCaseDefinitionByKey(String caseDefinitionKey) {
        CaseDefinition caseDefinition = caseDefinitionEntityManager.findLatestCaseDefinitionByKey(caseDefinitionKey);

View on GitHub (pinned to d6d39ce1c6)