{"record":{"id":"a4892a6b3ef37a05","repo":"flowable/flowable-engine","slug":"key-is-null","errorCode":null,"errorMessage":"key is null","messagePattern":"key is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/repository/AppDefinitionQueryImpl.java","lineNumber":151,"sourceCode":"        this.deploymentId = deploymentId;\n        return this;\n    }\n\n    @Override\n    public AppDefinitionQueryImpl deploymentIds(Set<String> deploymentIds) {\n        if (deploymentIds == null) {\n            throw new FlowableIllegalArgumentException(\"ids are null\");\n        } else if (deploymentIds.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"ids is an empty collection\");\n        }\n        this.deploymentIds = deploymentIds;\n        return this;\n    }\n\n    @Override\n    public AppDefinitionQueryImpl appDefinitionKey(String key) {\n        if (key == null) {\n            throw new FlowableIllegalArgumentException(\"key is null\");\n        }\n        this.key = key;\n        return this;\n    }\n\n    @Override\n    public AppDefinitionQueryImpl appDefinitionKeyLike(String keyLike) {\n        if (keyLike == null) {\n            throw new FlowableIllegalArgumentException(\"keyLike is null\");\n        }\n        this.keyLike = keyLike;\n        return this;\n    }\n\n    @Override\n    public AppDefinitionQueryImpl appDefinitionResourceName(String resourceName) {\n        if (resourceName == null) {\n            throw new FlowableIllegalArgumentException(\"resourceName is null\");","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-app-engine/src/main/java/org/flowable/app/engine/impl/repository/AppDefinitionQueryImpl.java#L133-L169","documentation":"appDefinitionKey(null) throws FlowableIllegalArgumentException because the app definition key is used in an exact-match predicate and null is treated as a caller mistake rather than 'no filter'. Validation runs in the query builder before execution.","triggerScenarios":"Calling appDefinitionQuery.appDefinitionKey(key) with a null key — typically an unbound variable, a missing config/property value, or the result of a lookup that found nothing.","commonSituations":"Application configuration missing the app key; passing another entity's null key attribute; optional REST parameter forwarded unconditionally.","solutions":["Null-check and only apply the key criterion when present","Fail earlier with a clearer message if the key is required by your business logic","Catch FlowableIllegalArgumentException and map it to a 400 response"],"exampleFix":"// before\nquery.appDefinitionKey(appKey);\n// after\nif (appKey != null) {\n    query.appDefinitionKey(appKey);\n}","handlingStrategy":"validation","validationCode":"if (key != null) {\n    query.appDefinitionKey(key);\n}","typeGuard":"boolean isApplicable(String v) { return v != null && !v.isEmpty(); }","tryCatchPattern":"try {\n    query.appDefinitionKey(key);\n} catch (FlowableIllegalArgumentException e) {\n    throw new ResponseStatusException(HttpStatus.BAD_REQUEST, e.getMessage(), e);\n}","preventionTips":["Validate configuration-provided keys at startup so they are never null at query time","Null-check keys pulled from other entities before use","Use Optional<String> for optional key filters and apply conditionally"],"tags":["flowable","null-check","query-builder","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"}