{"record":{"id":"e4d826e44a5ec3ab","repo":"flowable/flowable-engine","slug":"keylike-is-null-e4d826","errorCode":null,"errorMessage":"keyLike is null","messagePattern":"keyLike is null","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/engine/impl/ProcessDefinitionQueryImpl.java","lineNumber":168,"sourceCode":"            throw new ActivitiIllegalArgumentException(\"ids are null\");\n        }\n        this.deploymentIds = deploymentIds;\n        return this;\n    }\n\n    @Override\n    public ProcessDefinitionQueryImpl processDefinitionKey(String key) {\n        if (key == null) {\n            throw new ActivitiIllegalArgumentException(\"key is null\");\n        }\n        this.key = key;\n        return this;\n    }\n\n    @Override\n    public ProcessDefinitionQueryImpl processDefinitionKeyLike(String keyLike) {\n        if (keyLike == null) {\n            throw new ActivitiIllegalArgumentException(\"keyLike is null\");\n        }\n        this.keyLike = keyLike;\n        return this;\n    }\n\n    @Override\n    public ProcessDefinitionQueryImpl processDefinitionResourceName(String resourceName) {\n        if (resourceName == null) {\n            throw new ActivitiIllegalArgumentException(\"resourceName is null\");\n        }\n        this.resourceName = resourceName;\n        return this;\n    }\n\n    @Override\n    public ProcessDefinitionQueryImpl processDefinitionResourceNameLike(String resourceNameLike) {\n        if (resourceNameLike == null) {\n            throw new ActivitiIllegalArgumentException(\"resourceNameLike is null\");","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable5-engine/src/main/java/org/activiti/engine/impl/ProcessDefinitionQueryImpl.java#L150-L186","documentation":"ProcessDefinitionQueryImpl.processDefinitionKeyLike(String) throws ActivitiIllegalArgumentException 'keyLike is null' when the LIKE pattern is null. Like its siblings, the query builder validates the pattern eagerly to keep the generated SQL predicate valid. A null pattern is a caller contract violation, not a runtime query failure.","triggerScenarios":"Calling ProcessDefinitionQuery.processDefinitionKeyLike(null), typically when the pattern comes from an optional request parameter or config value that is absent.","commonSituations":"Search UIs forwarding empty/absent pattern inputs; naming-convention filters configured via properties that are missing in one environment; refactors removing a default pattern constant.","solutions":["Supply a non-null LIKE pattern such as \"%invoice%\"","Only call processDefinitionKeyLike when the pattern is non-null; otherwise skip the filter","Use \"%\" as a match-all default if that matches the intended semantics","Catch ActivitiIllegalArgumentException to convert it into a 400-style client error"],"exampleFix":"// before\nquery.processDefinitionKeyLike(searchForm.getKeyPattern());\n// after\nif (searchForm.getKeyPattern() != null) {\n    query.processDefinitionKeyLike(searchForm.getKeyPattern());\n}","handlingStrategy":"validation","validationCode":"if (keyLike == null) throw new IllegalArgumentException(\"keyLike pattern is required\");\nquery.processDefinitionKeyLike(keyLike);","typeGuard":"boolean isValidPattern(String s) { return s != null && !s.isEmpty(); }","tryCatchPattern":"try {\n    query.processDefinitionKeyLike(keyLike);\n} catch (ActivitiIllegalArgumentException e) {\n    if (e.getMessage().contains(\"keyLike is null\")) {\n        throw new BadRequestException(\"keyLike pattern must not be null\");\n    }\n    throw e;\n}","preventionTips":["Provide default LIKE patterns (e.g. \"%\") for optional search inputs","Sanitize and null-check search form fields before applying them","Apply LIKE filters conditionally with ifPresent on Optional inputs","Escape user-supplied % and _ in patterns to avoid unintended matches"],"tags":["java","null-argument","query-builder","activiti","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"}