{"record":{"id":"d82d45c277fe479d","repo":"flowable/flowable-engine","slug":"taskids-is-null-d82d45","errorCode":null,"errorMessage":"taskIds is null","messagePattern":"taskIds is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/VariableInstanceQueryImpl.java","lineNumber":136,"sourceCode":"    @Override\n    public VariableInstanceQuery taskId(String taskId) {\n        if (taskId == null) {\n            throw new FlowableIllegalArgumentException(\"taskId is null\");\n        }\n        if (excludeTaskRelated) {\n            throw new FlowableIllegalArgumentException(\"Cannot use taskId together with excludeTaskVariables\");\n        }\n        if (excludeLocalVariables) {\n            throw new FlowableIllegalArgumentException(\"Cannot use taskIds together with excludeLocalVariables\");\n        }\n        this.taskId = taskId;\n        return this;\n    }\n\n    @Override\n    public VariableInstanceQueryImpl taskIds(Set<String> taskIds) {\n        if (taskIds == null) {\n            throw new FlowableIllegalArgumentException(\"taskIds is null\");\n        }\n        if (taskIds.isEmpty()) {\n            throw new FlowableIllegalArgumentException(\"Set of taskIds is empty\");\n        }\n        if (excludeTaskRelated) {\n            throw new FlowableIllegalArgumentException(\"Cannot use taskIds together with excludeTaskVariables\");\n        }\n        if (excludeLocalVariables) {\n            throw new FlowableIllegalArgumentException(\"Cannot use taskIds together with excludeLocalVariables\");\n        }\n        this.taskIds = taskIds;\n        return this;\n    }\n\n    @Override\n    public VariableInstanceQuery excludeTaskVariables() {\n        if (taskId != null) {\n            throw new FlowableIllegalArgumentException(\"Cannot use taskId together with excludeTaskVariables\");","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-variable-service/src/main/java/org/flowable/variable/service/impl/VariableInstanceQueryImpl.java#L118-L154","documentation":"VariableInstanceQuery.taskIds(Set<String>) requires a non-null set. Passing null throws FlowableIllegalArgumentException immediately at query-build time because an absent id collection cannot form a valid filter.","triggerScenarios":"Passing null to taskIds(), e.g. query.taskIds(taskIdsFromUpstream) where the upstream set was never created or a lookup returned null.","commonSituations":"Batch code aggregating task ids across processes where no tasks matched, leaving the collection null; or optional parameter plumbing that forwards null.","solutions":["Initialize the set before use and only call taskIds() when non-null","Skip the taskIds() filter when the collection is null and apply other criteria","Return an empty/default result early instead of building the query"],"exampleFix":"// before\nquery.taskIds(taskIds); // may be null\n// after\nif (taskIds != null) {\n    query.taskIds(taskIds);\n}","handlingStrategy":"validation","validationCode":"if (taskIds == null) {\n    throw new IllegalArgumentException(\"taskIds must be non-null before querying\");\n}","typeGuard":"Set<String> safeSet(Set<String> s) { return s == null ? Collections.emptySet() : s; }","tryCatchPattern":"try {\n    query.taskIds(taskIds);\n} catch (FlowableIllegalArgumentException e) {\n    if (e.getMessage().equals(\"taskIds is null\")) {\n        // rebuild query without taskIds filter\n    } else { throw e; }\n}","preventionTips":["Initialize task id collections at declaration","Null-check collections gathered in loops before querying","Avoid passing optional parameters straight through to Flowable builders"],"tags":["flowable","null-check","query-validation","variable-instance-query"],"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"}