flowable/flowable-engine · error · UnsupportedOperationException

Not supported to set text value

Error message

Not supported to set text value

What it means

BatchDeleteProcessConfig's VariableScope is a read-only, JSON-backed snapshot; variable values are only read from the backing JSON node. setTextValue() is a mutating setter that is intentionally unsupported and always throws UnsupportedOperationException.

Solutions

  1. Do not mutate variables through this scope; perform variable changes via runtimeService.setVariable(...) on live instances before deletion
  2. Treat the scope as strictly read-only — use the getters backed by the JSON node
  3. Catch UnsupportedOperationException only when writing to an unknown VariableScope defensively
  4. Create a separate writable VariableScope implementation for custom flows

Example fix

// before
batchScope.setTextValue("new"); // throws
// after
runtimeService.setVariable(processInstanceId, "myVar", "new"); // on a live instance, before delete
Defensive patterns

Strategy: validation

Validate before calling

// write variables only on live instances, never on the batch-delete template scope
if (scope instanceof org.flowable.engine.impl.delete.BatchDeleteProcessConfig.DeleteVariableScope) {
    throw new IllegalStateException("Scope is read-only; use runtimeService.setVariable");
}
scope.setTextValue(value);

Try / catch

try {
    scope.setTextValue(value);
} catch (UnsupportedOperationException e) {
    runtimeService.setVariable(processInstanceId, varName, value); // fallback to live instance
}

Prevention

When it happens

Trigger: Calling setTextValue(String) on the template scope — e.g. custom batch part logic that tries to modify a string variable, or code reusing variable-writing utilities during batch delete.

Common situations: Variable-update code paths shared with normal execution; attempts to 'fix' variable data while deleting; accidental reuse of the delete template as a working variable scope.

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/8fdcb5720fedcaa5. Report an issue: GitHub.

Appendix: source

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

        @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
        public void setTextValue2(String textValue2) {
            throw new UnsupportedOperationException("Not supported to set text value2");
        }

        @Override
        public Long getLongValue() {
            JsonNode longNode = node.path("longValue");
            if (longNode.isNumber()) {
                return longNode.longValue();
            }

View on GitHub (pinned to d6d39ce1c6)