{"record":{"id":"c7a5e29d99b41cba","repo":"flowable/flowable-engine","slug":"not-supported-to-get-task-id","errorCode":null,"errorMessage":"Not supported to get task id","messagePattern":"Not supported to get task id","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine/src/main/java/org/flowable/engine/impl/delete/BatchDeleteProcessConfig.java","lineNumber":497,"sourceCode":"\n        @Override\n        public String getScopeId() {\n            throw new UnsupportedOperationException(\"Not supported to get scope id\");\n        }\n\n        @Override\n        public String getSubScopeId() {\n            throw new UnsupportedOperationException(\"Not supported to get sub scope id\");\n        }\n\n        @Override\n        public String getScopeType() {\n            throw new UnsupportedOperationException(\"Not supported to scope type\");\n        }\n\n        @Override\n        public String getTaskId() {\n            throw new UnsupportedOperationException(\"Not supported to get task id\");\n        }\n\n        @Override\n        public String getTextValue() {\n            return node.path(\"textValue\").stringValue(null);\n        }\n\n        @Override\n        public void setTextValue(String textValue) {\n            throw new UnsupportedOperationException(\"Not supported to set text value\");\n        }\n\n        @Override\n        public String getTextValue2() {\n            return node.path(\"textValues\").stringValue(null);\n        }\n\n        @Override","sourceCodeStart":479,"sourceCodeEnd":515,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine/src/main/java/org/flowable/engine/impl/delete/BatchDeleteProcessConfig.java#L479-L515","documentation":"The VariableScope stub in BatchDeleteProcessConfig has no task semantics, so getTaskId() is unimplemented and always throws UnsupportedOperationException. It exists purely to satisfy the interface for the delete-template use case.","triggerScenarios":"Calling getTaskId() on the batch-delete template scope from task-related generic code, listeners, or expressions evaluated while configuring/running the delete batch.","commonSituations":"Shared VariableScope utilities that read taskId; code copied from task listener contexts; generic variable query builders that include taskId.","solutions":["Stop reading taskId from this scope; process-instance batch delete never involves a single task id","Fetch task information via TaskService queries before building the delete batch if needed","Guard generic consumers with try-catch on UnsupportedOperationException or an instanceof check against the delete template scope","Override in a subclass if a custom flow requires a task context"],"exampleFix":"// before\nString taskId = batchScope.getTaskId(); // throws\n// after\nTask task = taskService.createTaskQuery().processInstanceId(piId).singleResult(); // if a task is actually needed","handlingStrategy":"type-guard","validationCode":"boolean hasTask = !(scope instanceof org.flowable.engine.impl.delete.BatchDeleteProcessConfig.DeleteVariableScope);","typeGuard":"String safeGetTaskId(VariableScope s) {\n    try { return s.getTaskId(); } catch (UnsupportedOperationException e) { return null; }\n}","tryCatchPattern":"try {\n    String taskId = scope.getTaskId();\n} catch (UnsupportedOperationException e) {\n    // no task context in batch-delete template scope\n}","preventionTips":["Resolve tasks via TaskService queries, not the delete template scope","Keep task-listener code out of batch-delete paths","Return null-safe defaults in generic scope readers"],"tags":["unsupported-operation","flowable","batch-delete","task-id"],"backgroundTag":"unsupported-operation","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"}