{"record":{"id":"7f6222592f450837","repo":"flowable/flowable-engine","slug":"case-definition-name-is-null-7f6222","errorCode":null,"errorMessage":"Case definition name is null","messagePattern":"Case definition name 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":251,"sourceCode":"    \n    @Override\n    public CaseInstanceQueryImpl caseDefinitionCategoryLikeIgnoreCase(String caseDefinitionCategoryLikeIgnoreCase) {\n        if (caseDefinitionCategoryLikeIgnoreCase == null) {\n            throw new FlowableIllegalArgumentException(\"Case definition category is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.caseDefinitionCategoryLikeIgnoreCase = caseDefinitionCategoryLikeIgnoreCase;\n        } else {\n            this.caseDefinitionCategoryLikeIgnoreCase = caseDefinitionCategoryLikeIgnoreCase;\n        }\n        return this;\n    }\n\n    @Override\n    public CaseInstanceQueryImpl caseDefinitionName(String caseDefinitionName) {\n        if (caseDefinitionName == null) {\n            throw new FlowableIllegalArgumentException(\"Case definition name is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.caseDefinitionName = caseDefinitionName;\n        } else {\n            this.caseDefinitionName = caseDefinitionName;\n        }\n        return this;\n    }\n    \n    @Override\n    public CaseInstanceQueryImpl caseDefinitionNameLike(String caseDefinitionNameLike) {\n        if (caseDefinitionNameLike == null) {\n            throw new FlowableIllegalArgumentException(\"Case definition name is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.caseDefinitionNameLike = caseDefinitionNameLike;","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java#L233-L269","documentation":"Flowable throws FlowableIllegalArgumentException from CaseInstanceQueryImpl.caseDefinitionName(String) when the supplied case definition name is null. Query criteria methods in Flowable validate arguments eagerly so that a malformed query fails immediately at build time rather than producing an invalid SQL query or misleading empty results at execution time. A null name is never a valid filter value; omit the call entirely instead.","triggerScenarios":"Calling cmmnRuntimeService.createCaseInstanceQuery().caseDefinitionName(null) directly, or passing a variable that is null (e.g. an unresolved config value, missing request parameter, or unset field) into caseDefinitionName().","commonSituations":"REST/API query endpoints where the client omitted the definitionName filter and the code forwards the raw null; property/config lookups returning null; refactors that changed the default value of a name variable from empty string to null.","solutions":["Do not call caseDefinitionName when the value is null — build the query conditionally: if (name != null) query.caseDefinitionName(name)","Default the input to a non-null sentinel before calling (e.g. name == null ? \"\" : name) only if an empty-ish match is truly intended","Use caseDefinitionKey or another criterion if the name is unknown and you need a valid filter","Wrap the query building in a FlowableIllegalArgumentException catch to surface a friendlier message to API callers"],"exampleFix":"// before\nString name = request.getParameter(\"definitionName\"); // may be null\nCaseInstanceQuery q = runtimeService.createCaseInstanceQuery().caseDefinitionName(name);\n// after\nString name = request.getParameter(\"definitionName\");\nCaseInstanceQuery q = runtimeService.createCaseInstanceQuery();\nif (name != null) {\n    q.caseDefinitionName(name);\n}","handlingStrategy":"validation","validationCode":"if (caseDefinitionName != null) { query.caseDefinitionName(caseDefinitionName); }","typeGuard":"boolean hasName = (name instanceof String s) && !s.isEmpty();","tryCatchPattern":"try { query.caseDefinitionName(name); } catch (FlowableIllegalArgumentException e) { log.warn(\"Invalid query argument: {}\", e.getMessage()); throw new BadRequestException(e.getMessage()); }","preventionTips":["Treat every Flowable query criteria method as rejecting null; always conditionally apply optional filters","Never forward raw request parameters or DTO fields to query methods without a null check","In generic filter-to-query mappers, skip entries whose value is null"],"tags":["flowable","cmmn","query","null-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"}