flowable/flowable-engine · error · UnsupportedOperationException

Not supported to get task id

Error message

Not supported to get task id

What it means

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.

Solutions

  1. Stop reading taskId from this scope; process-instance batch delete never involves a single task id
  2. Fetch task information via TaskService queries before building the delete batch if needed
  3. Guard generic consumers with try-catch on UnsupportedOperationException or an instanceof check against the delete template scope
  4. Override in a subclass if a custom flow requires a task context

Example fix

// before
String taskId = batchScope.getTaskId(); // throws
// after
Task task = taskService.createTaskQuery().processInstanceId(piId).singleResult(); // if a task is actually needed
Defensive patterns

Strategy: type-guard

Validate before calling

boolean hasTask = !(scope instanceof org.flowable.engine.impl.delete.BatchDeleteProcessConfig.DeleteVariableScope);

Type guard

String safeGetTaskId(VariableScope s) {
    try { return s.getTaskId(); } catch (UnsupportedOperationException e) { return null; }
}

Try / catch

try {
    String taskId = scope.getTaskId();
} catch (UnsupportedOperationException e) {
    // no task context in batch-delete template scope
}

Prevention

When it happens

Trigger: Calling getTaskId() on the batch-delete template scope from task-related generic code, listeners, or expressions evaluated while configuring/running the delete batch.

Common situations: Shared VariableScope utilities that read taskId; code copied from task listener contexts; generic variable query builders that include taskId.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of flowable/flowable-engine@d6d39ce1c6 (2026-09-11). Data as JSON: /api/errors/c7a5e29d99b41cba. Report an issue: GitHub.

Appendix: source

Thrown at modules/flowable-engine/src/main/java/org/flowable/engine/impl/delete/BatchDeleteProcessConfig.java:497

        @Override
        public String getScopeId() {
            throw new UnsupportedOperationException("Not supported to get scope id");
        }

        @Override
        public String getSubScopeId() {
            throw new UnsupportedOperationException("Not supported to get sub scope id");
        }

        @Override
        public String getScopeType() {
            throw new UnsupportedOperationException("Not supported to scope type");
        }

        @Override
        public String getTaskId() {
            throw new UnsupportedOperationException("Not supported to get task id");
        }

        @Override
        public String getTextValue() {
            return node.path("textValue").stringValue(null);
        }

        @Override
        public void setTextValue(String textValue) {
            throw new UnsupportedOperationException("Not supported to set text value");
        }

        @Override
        public String getTextValue2() {
            return node.path("textValues").stringValue(null);
        }

        @Override

View on GitHub (pinned to d6d39ce1c6)