{"record":{"id":"8e62f428d454546c","repo":"flowable/flowable-engine","slug":"process-definition-version-is-null-8e62f4","errorCode":null,"errorMessage":"Process definition version is null","messagePattern":"Process definition version is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/ExecutionQueryImpl.java","lineNumber":134,"sourceCode":"            throw new ActivitiIllegalArgumentException(\"Process definition category is null\");\n        }\n        this.processDefinitionCategory = processDefinitionCategory;\n        return this;\n    }\n\n    @Override\n    public ExecutionQuery processDefinitionName(String processDefinitionName) {\n        if (processDefinitionName == null) {\n            throw new ActivitiIllegalArgumentException(\"Process definition name is null\");\n        }\n        this.processDefinitionName = processDefinitionName;\n        return this;\n    }\n\n    @Override\n    public ExecutionQuery processDefinitionVersion(Integer processDefinitionVersion) {\n        if (processDefinitionVersion == null) {\n            throw new ActivitiIllegalArgumentException(\"Process definition version is null\");\n        }\n        this.processDefinitionVersion = processDefinitionVersion;\n        return this;\n    }\n\n    @Override\n    public ExecutionQueryImpl processInstanceId(String processInstanceId) {\n        if (processInstanceId == null) {\n            throw new ActivitiIllegalArgumentException(\"Process instance id is null\");\n        }\n        this.processInstanceId = processInstanceId;\n        return this;\n    }\n\n    @Override\n    public ExecutionQuery processInstanceBusinessKey(String businessKey) {\n        if (businessKey == null) {\n            throw new ActivitiIllegalArgumentException(\"Business key is null\");","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/ExecutionQueryImpl.java#L116-L152","documentation":"ExecutionQueryImpl.processDefinitionVersion throws ActivitiIllegalArgumentException when the version argument passed to processDefinitionVersion(Integer) is null. The query API validates that each filter criterion is non-null before storing it, so a null version would otherwise produce an invalid or ambiguous query. This is an eager fail-fast guard on the query builder.","triggerScenarios":"Calling query.processDefinitionVersion(someVersion) where someVersion is null, e.g. a variable holding the version was never initialized or a method parameter was forwarded as null.","commonSituations":"Dynamic query building where the version comes from configuration or a request parameter that is optional/absent; mixing up version-latest semantics (should use processDefinitionVersion or latest() instead of null); deserializing a query spec from JSON with a missing version field.","solutions":["Ensure a non-null Integer version is passed; only call processDefinitionVersion when the value is present","If you intend to query any version, do not call processDefinitionVersion at all instead of passing null","Validate/trim the value at the source (config, request param) before building the query"],"exampleFix":"// before\nquery.processDefinitionVersion(request.getVersion());\n// after\nInteger version = request.getVersion();\nif (version != null) {\n    query.processDefinitionVersion(version);\n}","handlingStrategy":"validation","validationCode":"if (version != null) { query.processDefinitionVersion(version); }","typeGuard":"boolean hasVersion = (version instanceof Integer);","tryCatchPattern":"try { query.processDefinitionVersion(v); } catch (ActivitiIllegalArgumentException e) { log.warn(\"Bad query argument: {}\", e.getMessage()); }","preventionTips":["Only call version/tenant/criteria setters when the value is present","Use latest() instead of a null version when any version is acceptable","Validate optional request/config fields before building queries"],"tags":["java","activiti","query-builder","null-check"],"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"}