{"record":{"id":"cecd0ecb681f0e3a","repo":"flowable/flowable-engine","slug":"provided-element-ids-are-null","errorCode":null,"errorMessage":"Provided element ids are null","messagePattern":"Provided element ids 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":213,"sourceCode":"    }\n    \n    @Override\n    public DeadLetterJobQueryImpl elementId(String elementId) {\n        if (elementId == null) {\n            throw new FlowableIllegalArgumentException(\"Provided element id is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.elementId = elementId;\n        } else {\n            this.elementId = elementId;\n        }\n        return this;\n    }\n\n    @Override\n    public DeadLetterJobQuery elementIds(Collection<String> elementIds) {\n        if (elementIds == null) {\n            throw new FlowableIllegalArgumentException(\"Provided element ids are null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.elementIds = elementIds;\n        } else {\n            this.elementIds = elementIds;\n        }\n        return this;\n    }\n    \n    @Override\n    public DeadLetterJobQueryImpl elementName(String elementName) {\n        if (elementName == null) {\n            throw new FlowableIllegalArgumentException(\"Provided element name is null\");\n        }\n        if (inOrStatement) {\n            this.currentOrQueryObject.elementName = elementName;\n        } else {\n            this.elementName = elementName;","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/DeadLetterJobQueryImpl.java#L195-L231","documentation":"DeadLetterJobQueryImpl.elementIds(Collection<String>) throws FlowableIllegalArgumentException when the whole collection is null. Flowable distinguishes a null collection (invalid input, rejected) from an empty collection (a filter that matches nothing). Only the collection reference itself is checked; null elements inside the collection are not validated here.","triggerScenarios":"Calling deadLetterJobQuery().elementIds(null), usually when the list was initialized conditionally and never assigned, or a deserialized request omitted the field so the mapper left it null.","commonSituations":"REST/GraphQL queries where the elementIds array is optional and deserializes to null; code paths that build the collection only under a condition but always call the setter; Jackson/Gson binding producing null for missing JSON keys.","solutions":["Null-check the collection before calling elementIds(...)","If the caller passed an empty list intentionally, note that empty means 'match nothing' - decide which semantics you want","Initialize the collection to Collections.emptyList() at declaration to avoid null references","Coerce missing request fields to empty lists at deserialization time"],"exampleFix":"// before\nquery.elementIds(request.getElementIds()); // null when field absent\n\n// after\nCollection<String> ids = request.getElementIds();\nDeadLetterJobQuery query = jobService.createDeadLetterJobQuery();\nif (ids != null && !ids.isEmpty()) {\n    query = query.elementIds(ids);\n}","handlingStrategy":"validation","validationCode":"Collection<String> ids = request.getElementIds();\nif (ids != null && !ids.isEmpty()) {\n    query = query.elementIds(ids);\n}","typeGuard":"boolean hasElements(Collection<String> ids) { return ids != null && !ids.isEmpty(); }","tryCatchPattern":"try {\n    return query.elementIds(elementIds).list();\n} catch (FlowableIllegalArgumentException e) {\n    throw new InvalidQueryRequestException(\"elementIds collection must not be null\", e);\n}","preventionTips":["Initialize collections to Collections.emptyList() instead of leaving them null","Configure deserializers (Jackson) to map absent arrays to empty collections","Decide explicitly whether an empty list should match nothing or mean 'no filter'","Null-check collections before passing them into any Flowable query setter"],"tags":["flowable","null-argument","collection","query-builder"],"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"}