{"record":{"id":"43783410984957ee","repo":"flowable/flowable-engine","slug":"provided-element-ids-are-null-437834","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/SuspendedJobQueryImpl.java","lineNumber":216,"sourceCode":"    }\n    \n    @Override\n    public SuspendedJobQueryImpl 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 SuspendedJobQueryImpl 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 SuspendedJobQueryImpl 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":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-job-service/src/main/java/org/flowable/job/service/impl/SuspendedJobQueryImpl.java#L198-L234","documentation":"This FlowableIllegalArgumentException is thrown by SuspendedJobQueryImpl.elementIds() when the caller passes a null Collection. Flowable query builders validate filter arguments eagerly so that a malformed query fails immediately at the call site instead of producing an empty or misleading result set (or a SQL error) when list() is executed. Passing null is considered a programming error, not a valid filter value.","triggerScenarios":"Calling suspendedJobQuery().elementIds(null), e.g. when the collection is the result of a method that returned null instead of an empty list, or when an optional variable holding the ids was never initialized.","commonSituations":"Mapping a variable that is null when the user provided no element-id filter; a service method returning null rather than Collections.emptyList(); refactoring code where an ids parameter became nullable.","solutions":["Do not call elementIds() when the collection is null — apply the filter conditionally","Initialize the collection to an empty list (Collections.emptyList()) instead of null","Check the upstream producer of the collection so it never returns null","If the intent is 'no filter', simply omit the elementIds() call"],"exampleFix":"// before\nquery.elementIds(elementIds); // elementIds may be null\n// after\nif (elementIds != null) {\n    query.elementIds(elementIds);\n}","handlingStrategy":"validation","validationCode":"if (elementIds != null) {\n    query.elementIds(elementIds);\n}","typeGuard":"boolean hasElementIds = elementIds != null && !elementIds.isEmpty();","tryCatchPattern":"try {\n    query.elementIds(elementIds);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().contains(\"element ids are null\")) {\n        query = taskQueryService.createSuspendedJobQuery(); // rebuild without filter\n    } else {\n        throw e;\n    }\n}","preventionTips":["Never return null collections from producer methods; return Collections.emptyList()","Use Optional<Collection<String>> at API boundaries to force null handling","Apply query filters conditionally via a query-builder helper","Unit-test query assembly with absent/optional filters"],"tags":["java","flowable","query","null-check","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-18T11:17:12.947Z"}