{"record":{"id":"4a01963f5f21bde0","repo":"flowable/flowable-engine","slug":"process-definition-category-is-null-4a0196","errorCode":null,"errorMessage":"Process definition category is null","messagePattern":"Process definition category is null","errorType":"exception","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/ProcessInstanceQueryImpl.java","lineNumber":192,"sourceCode":"            this.tenantIdLike = tenantIdLike;\n        }\n        return this;\n    }\n\n    @Override\n    public ProcessInstanceQuery processInstanceWithoutTenantId() {\n        if (inOrStatement) {\n            this.currentOrQueryObject.withoutTenantId = true;\n        } else {\n            this.withoutTenantId = true;\n        }\n        return this;\n    }\n\n    @Override\n    public ProcessInstanceQuery processDefinitionCategory(String processDefinitionCategory) {\n        if (processDefinitionCategory == null) {\n            throw new ActivitiIllegalArgumentException(\"Process definition category is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.processDefinitionCategory = processDefinitionCategory;\n        } else {\n            this.processDefinitionCategory = processDefinitionCategory;\n        }\n        return this;\n    }\n\n    @Override\n    public ProcessInstanceQuery processDefinitionName(String processDefinitionName) {\n        if (processDefinitionName == null) {\n            throw new ActivitiIllegalArgumentException(\"Process definition name is null\");\n        }\n\n        if (inOrStatement) {\n            this.currentOrQueryObject.processDefinitionName = processDefinitionName;","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/ProcessInstanceQueryImpl.java#L174-L210","documentation":"ProcessInstanceQueryImpl.processDefinitionCategory(String) throws ActivitiIllegalArgumentException when the processDefinitionCategory argument is null. Filter values in the query API must be concrete values; null means 'no filter' and is expressed by simply not calling the method. The check happens immediately so invalid queries fail at build time.","triggerScenarios":"Calling .processDefinitionCategory(null) — usually a category value pulled from a request parameter, saved filter, or database row that is null.","commonSituations":"REST endpoints forwarding unvalidated query params into process instance queries; stored search filters where the category field was never populated; null vs empty-string confusion when mapping form data.","solutions":["Only call processDefinitionCategory when a non-null category is available (conditional chaining).","Treat an absent category as 'no filter' and omit the call instead of passing null.","Validate/normalize request input upstream (reject nulls or map them to 'all').","Catch ActivitiIllegalArgumentException around query building and return a 400-style validation error."],"exampleFix":"// before\nquery.processDefinitionCategory(category); // category may be null\n// after\nif (category != null) {\n    query = query.processDefinitionCategory(category);\n}","handlingStrategy":"validation","validationCode":"if (category == null) {\n    // omit filter entirely\n} else {\n    query = query.processDefinitionCategory(category);\n}","typeGuard":"boolean hasCategory(String category) { return category != null && !category.trim().isEmpty(); }","tryCatchPattern":"try {\n    result = query.processDefinitionCategory(category).list();\n} catch (ActivitiIllegalArgumentException e) {\n    if (e.getMessage().contains(\"Process definition category is null\")) {\n        throw new BadRequestException(\"category must not be null\");\n    }\n    throw e;\n}","preventionTips":["Map blank form/request fields to 'no filter' instead of null.","Validate filter DTOs before converting them into ProcessInstanceQuery calls.","Keep query construction in a single utility so null-guards are applied uniformly.","Distinguish null from empty string; both should mean 'no filter' by convention."],"tags":["java","activiti","flowable","null-argument","query-validation"],"backgroundTag":"null-argument","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}