{"record":{"id":"49595bc3145460ab","repo":"flowable/flowable-engine","slug":"case-definition-id-is-null-49595b","errorCode":null,"errorMessage":"Case definition id is null","messagePattern":"Case definition id is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java","lineNumber":142,"sourceCode":"\n    public CaseInstanceQueryImpl(CommandExecutor commandExecutor, CmmnEngineConfiguration cmmnEngineConfiguration) {\n        super(commandExecutor, cmmnEngineConfiguration.getVariableServiceConfiguration());\n        this.cmmnEngineConfiguration = cmmnEngineConfiguration;\n    }\n\n    @Override\n    protected void ensureVariablesInitialized() {\n        super.ensureVariablesInitialized();\n\n        for (CaseInstanceQueryImpl orQueryObject : orQueryObjects) {\n            orQueryObject.ensureVariablesInitialized();\n        }\n    }\n\n    @Override\n    public CaseInstanceQueryImpl caseDefinitionId(String caseDefinitionId) {\n        if (caseDefinitionId == null) {\n            throw new FlowableIllegalArgumentException(\"Case definition id is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.caseDefinitionId = caseDefinitionId;\n        } else {\n            this.caseDefinitionId = caseDefinitionId;\n        }\n        return this;\n    }\n\n    @Override\n    public CaseInstanceQueryImpl caseDefinitionIds(Set<String> caseDefinitionIds) {\n        if (caseDefinitionIds == null) {\n            throw new FlowableIllegalArgumentException(\"Case definition ids is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.caseDefinitionIds = caseDefinitionIds;","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java#L124-L160","documentation":"CaseInstanceQueryImpl.caseDefinitionId validates its argument before storing it on the query object. Passing null throws FlowableIllegalArgumentException because a null caseDefinitionId filter is ambiguous with 'no filter'; callers must simply not call the method instead of passing null.","triggerScenarios":"cmmnRuntimeService.createCaseInstanceQuery().caseDefinitionId(null).list() — directly or via a variable holding the id that is null.","commonSituations":"Wiring a search/filter form where the definition-id field is optional and the raw value is forwarded without a null check; mapping query params to query criteria generically.","solutions":["Pass a non-null case definition id string.","Skip calling caseDefinitionId when the value is null (build the query conditionally).","At the API boundary, coerce empty/absent values to 'do not filter' rather than null."],"exampleFix":"// before\nquery.caseDefinitionId(request.getDefinitionId()).list();\n// after\nif (request.getDefinitionId() != null) {\n    query = query.caseDefinitionId(request.getDefinitionId());\n}\nquery.list();","handlingStrategy":"validation","validationCode":"if (caseDefinitionId != null) {\n    query = query.caseDefinitionId(caseDefinitionId);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never pass null to query filter methods; skip the call instead.","Centralize query building in a helper that applies filters conditionally.","Map absent request parameters to Optional.empty rather than null propagation."],"tags":["null-argument","query","cmmn","illegal-argument"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}