{"record":{"id":"3f8ccef81d809e97","repo":"flowable/flowable-engine","slug":"task-parentscopeid-is-null","errorCode":null,"errorMessage":"Task parentScopeId is null","messagePattern":"Task parentScopeId is null","errorType":"validation","errorClass":"FlowableIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/HistoricTaskInstanceQueryImpl.java","lineNumber":1412,"sourceCode":"            this.scopedVariableExists(name, ScopeTypes.CMMN);\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricTaskInstanceQuery caseVariableNotExists(String name) {\n        if (inOrStatement) {\n            currentOrQueryObject.scopedVariableNotExists(name, ScopeTypes.CMMN);\n        } else {\n            this.scopedVariableNotExists(name, ScopeTypes.CMMN);\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricTaskInstanceQuery taskRootScopeId(String rootScopeId) {\n        if (rootScopeId == null) {\n            throw new FlowableIllegalArgumentException(\"Task parentScopeId is null\");\n        }\n        if (inOrStatement) {\n            currentOrQueryObject.rootScopeId = rootScopeId;\n        } else {\n            this.rootScopeId = rootScopeId;\n        }\n        return this;\n    }\n\n    @Override\n    public HistoricTaskInstanceQuery taskParentScopeId(String parentScopeId) {\n        if (parentScopeId == null) {\n            throw new FlowableIllegalArgumentException(\"Task parentScopeId is null\");\n        }\n        if (inOrStatement) {\n            currentOrQueryObject.parentScopeId = parentScopeId;\n        } else {\n            this.parentScopeId = parentScopeId;","sourceCodeStart":1394,"sourceCodeEnd":1430,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-task-service/src/main/java/org/flowable/task/service/impl/HistoricTaskInstanceQueryImpl.java#L1394-L1430","documentation":"taskRootScopeId(String) requires a non-null root scope id; passing null throws this FlowableIllegalArgumentException (the message says 'parentScopeId' but the method is taskRootScopeId). The library validates arguments eagerly so the query never executes with an unset filter value.","triggerScenarios":"Calling taskRootScopeId(null) directly, or passing a variable/expression that resolves to null (e.g. process instance's root scope id not yet available).","commonSituations":"Dynamic query builders forwarding an optional scope-id parameter without a null check; copy-pasting the parentScopeId call into the rootScopeId slot.","solutions":["Check for null before calling taskRootScopeId and skip the filter when absent","Ensure the root scope id is actually resolved (e.g. via runtimeService/historic process instance) before querying","Use the correct method (taskParentScopeId) if a parent scope was intended"],"exampleFix":"// before\nquery.taskRootScopeId(rootScopeId); // may be null\n// after\nif (rootScopeId != null) { query.taskRootScopeId(rootScopeId); }","handlingStrategy":"validation","validationCode":"if (rootScopeId != null) { query.taskRootScopeId(rootScopeId); }","typeGuard":"boolean hasRootScopeId(String id) { return id != null && !id.isBlank(); }","tryCatchPattern":"try {\n    query.taskRootScopeId(rootScopeId);\n} catch (FlowableIllegalArgumentException e) {\n    // proceed without the scope filter or log and skip\n}","preventionTips":["Never pass optional ids straight into Flowable query setters","Resolve scope ids from the process/task APIs before querying","Use helper builders that apply filters only when values are present"],"tags":["query","validation","null"],"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"}