{"record":{"id":"0d2d6b190c160056","repo":"flowable/flowable-engine","slug":"case-definition-version-is-null-0d2d6b","errorCode":null,"errorMessage":"Case definition version is null","messagePattern":"Case definition version 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":293,"sourceCode":"    \n    @Override\n    public CaseInstanceQueryImpl caseDefinitionNameLikeIgnoreCase(String caseDefinitionNameLikeIgnoreCase) {\n        if (caseDefinitionNameLikeIgnoreCase == null) {\n            throw new FlowableIllegalArgumentException(\"Case definition name is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.caseDefinitionNameLikeIgnoreCase = caseDefinitionNameLikeIgnoreCase;\n        } else {\n            this.caseDefinitionNameLikeIgnoreCase = caseDefinitionNameLikeIgnoreCase;\n        }\n        return this;\n    }\n\n    @Override\n    public CaseInstanceQueryImpl caseDefinitionVersion(Integer caseDefinitionVersion) {\n        if (caseDefinitionVersion == null) {\n            throw new FlowableIllegalArgumentException(\"Case definition version is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.caseDefinitionVersion = caseDefinitionVersion;\n        } else {\n            this.caseDefinitionVersion = caseDefinitionVersion;\n        }\n        return this;\n    }\n\n    @Override\n    public CaseInstanceQueryImpl caseInstanceId(String caseInstanceId) {\n        if (caseInstanceId == null) {\n            throw new FlowableIllegalArgumentException(\"Case instance id is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.caseInstanceId = caseInstanceId;\n        } else {","sourceCodeStart":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-cmmn-engine/src/main/java/org/flowable/cmmn/engine/impl/runtime/CaseInstanceQueryImpl.java#L275-L311","documentation":"Flowable throws FlowableIllegalArgumentException from CaseInstanceQueryImpl.caseDefinitionVersion(Integer) when the version argument is null. Versions are integers and an unset version must simply not be added as a criterion; null is rejected at query-build time to keep the generated SQL valid.","triggerScenarios":"Calling createCaseInstanceQuery().caseDefinitionVersion(null), often because the version came from an Integer variable (request param parsed to null, unset DTO field) instead of an int default.","commonSituations":"REST endpoints where 'version' is optional and unboxed parsing yields null; migrating code from primitive int defaults to Integer wrappers; generic filter-to-query mappers.","solutions":["Add the criterion only when non-null: if (version != null) query.caseDefinitionVersion(version)","Parse with a default: int v = parseOrDefault(raw, -1) and call caseDefinitionVersion(v) only for valid values","If all versions are wanted, do not call the method at all — omit it rather than passing null","Catch FlowableIllegalArgumentException around query building to emit a validation error"],"exampleFix":"// before\nInteger version = params.get(\"version\"); // may be null\nquery.caseDefinitionVersion(version);\n// after\nInteger version = params.get(\"version\");\nif (version != null) {\n    query.caseDefinitionVersion(version);\n}","handlingStrategy":"validation","validationCode":"if (version != null) { query.caseDefinitionVersion(version); }","typeGuard":"boolean hasVersion = version != null && version >= 1;","tryCatchPattern":"try { query.caseDefinitionVersion(version); } catch (FlowableIllegalArgumentException e) { throw new BadRequestException(\"version must not be null\"); }","preventionTips":["Use primitive int with a sentinel or Optional<Integer> for optional version params","Avoid auto-unboxing nullable Integers into query calls","Document optional query params as 'omit, do not send 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"}