{"record":{"id":"0e7495a5ba425318","repo":"flowable/flowable-engine","slug":"provided-handlertypes-are-null","errorCode":null,"errorMessage":"Provided handlerTypes are null","messagePattern":"Provided handlerTypes are null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/DeadLetterJobQueryImpl.java","lineNumber":406,"sourceCode":"    }\n\n    @Override\n    public DeadLetterJobQueryImpl handlerType(String handlerType) {\n        if (handlerType == null) {\n            throw new FlowableIllegalArgumentException(\"Provided handlerType is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.handlerType = handlerType;\n        } else {\n            this.handlerType = handlerType;\n        }\n        return this;\n    }\n\n    @Override\n    public DeadLetterJobQuery handlerTypes(Collection<String> handlerTypes) {\n        if (handlerTypes == null) {\n            throw new FlowableIllegalArgumentException(\"Provided handlerTypes are null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.handlerTypes = handlerTypes;\n        } else {\n            this.handlerTypes = handlerTypes;\n        }\n        return this;\n    }\n\n    @Override\n    public DeadLetterJobQueryImpl executable() {\n        if (inOrStatement) {\n            this.currentOrQueryObject.executable = true;\n        } else {\n            this.executable = true;\n        }\n        return this;\n    }","sourceCodeStart":388,"sourceCodeEnd":424,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/DeadLetterJobQueryImpl.java#L388-L424","documentation":"DeadLetterJobQuery.handlerTypes(Collection<String>) throws FlowableIllegalArgumentException when the handlerTypes collection itself is null. This is the multi-value variant of handlerType() used for IN-style filtering; a null collection is rejected at construction time. Note the check is on the collection reference, not on its elements.","triggerScenarios":"Calling deadLetterJobQuery().handlerTypes(null), typically when a list built from configuration, a request, or a stream collector ended up null rather than empty, including within or() blocks.","commonSituations":"Deserialized config object with a null list field; Optional misused so orElse(null) produced null; frameworks binding empty request params to null.","solutions":["Pass an empty collection or skip the call entirely when no types are selected, instead of null.","Initialize collections with Collections.emptyList()/List.of() at declaration so they are never null.","If a null collection is possible, guard with if (types != null) query.handlerTypes(types)."],"exampleFix":"// before\nquery.handlerTypes(selectedTypes); // selectedTypes may be null\n// after\nif (selectedTypes != null && !selectedTypes.isEmpty()) {\n    query.handlerTypes(selectedTypes);\n}","handlingStrategy":"validation","validationCode":"Collection<String> types = Optional.ofNullable(selectedTypes).orElse(Collections.emptyList());\nif (!types.isEmpty()) { query.handlerTypes(types); }","typeGuard":"boolean hasHandlerTypes(Collection<String> c) { return c != null && !c.isEmpty(); }","tryCatchPattern":"try { query.handlerTypes(types); } catch (FlowableIllegalArgumentException e) { log.warn(\"Null handlerTypes collection supplied\"); }","preventionTips":["Initialize collections to empty, never null","Use Optional.orElse(Collections.emptyList()) when deserializing config","Skip the handlerTypes call when the selection is empty"],"tags":["flowable","query","null-check","collection"],"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"}