flowable/flowable-engine · error · FlowableIllegalArgumentException

caseDefinitionId is null

Error message

caseDefinitionId is null

What it means

GetCmmnModelCmd requires a caseDefinitionId to resolve the CMMN model from the deployment cache/manager. A null id makes resolution impossible, so Flowable throws FlowableIllegalArgumentException before any lookup. It guards the internal model-resolution path (findDeployedCaseDefinitionById).

Solutions

  1. Supply a valid non-null caseDefinitionId
  2. Resolve the definition id from the case instance (caseInstance.getCaseDefinitionId()) before calling
  3. Add boundary validation that the id is present

Example fix

// before
CmmnModel model = repositoryService.getCmmnModel(caseDefinitionId);
// after
String defId = Optional.ofNullable(caseInstance).map(CaseInstance::getCaseDefinitionId).orElse(caseDefinitionId);
if (defId == null) {
    throw new IllegalArgumentException("caseDefinitionId must be provided");
}
CmmnModel model = repositoryService.getCmmnModel(defId);
Defensive patterns

Strategy: validation

Validate before calling

if (caseDefinitionId == null || caseDefinitionId.isEmpty()) { throw new IllegalArgumentException("caseDefinitionId required"); }

Type guard

boolean hasDefId = defId != null && !defId.trim().isEmpty();

Try / catch

try { return repositoryService.getCmmnModel(caseDefinitionId); } catch (FlowableIllegalArgumentException e) { log.error("Missing case definition id"); throw e; }

Prevention

When it happens

Trigger: Calling getCmmnModel(caseDefinitionId) style APIs with a null caseDefinitionId, e.g. cmmnRepositoryService.getCmmnModel(null) or a caller passing an unset definition id.

Common situations: Definition id obtained from a case instance's variable or response field that is null; integration code that never set the id; template/config-driven lookups with a missing placeholder value.

Related errors


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

Appendix: source

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

import org.flowable.common.engine.api.FlowableIllegalArgumentException;
import org.flowable.common.engine.impl.interceptor.Command;
import org.flowable.common.engine.impl.interceptor.CommandContext;

/**
 * @author Joram Barrez
 */
public class GetCmmnModelCmd implements Command<CmmnModel> {

    protected String caseDefinitionId;

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

    @Override
    public CmmnModel execute(CommandContext commandContext) {
        if (caseDefinitionId == null) {
            throw new FlowableIllegalArgumentException("caseDefinitionId is null");
        }
        
        CmmnDeploymentManager deploymentManager = CommandContextUtil.getCmmnEngineConfiguration(commandContext).getDeploymentManager();
        CaseDefinition caseDefinition = deploymentManager.findDeployedCaseDefinitionById(caseDefinitionId);
        if (caseDefinition != null) {
            return deploymentManager.resolveCaseDefinition(caseDefinition).getCmmnModel();
        }
        return null;
    }
}

View on GitHub (pinned to d6d39ce1c6)