flowable/flowable-engine · error · UnsupportedOperationException

Not supported to set text value2

Error message

Not supported to set text value2

What it means

Same immutable JSON-backed VariableScope in BatchDeleteProcessConfig: setTextValue2(String) is a deliberate unsupported stub. The template scope only reads variable data for batch-delete serialization; all setters throw.

Solutions

  1. Never write variables via the delete template scope; mutate live instances with runtimeService.setVariable before scheduling deletion
  2. Treat the scope as read-only and use the JSON-backed getters only
  3. Add a defensive try-catch around variable writes on unknown scopes
  4. Subclass with an overriding implementation if a custom delete flow truly needs writes

Example fix

// before
batchScope.setTextValue2("x"); // throws
// after
// scope is read-only; write on a live instance if required
runtimeService.setVariable(instanceId, "myVar2", "x");
Defensive patterns

Strategy: try-catch

Validate before calling

if (scope instanceof org.flowable.engine.impl.delete.BatchDeleteProcessConfig.DeleteVariableScope) {
    // setter unsupported; mutate via runtimeService instead
}

Try / catch

try {
    scope.setTextValue2(value);
} catch (UnsupportedOperationException e) {
    runtimeService.setVariable(instanceId, varName, value);
}

Prevention

When it happens

Trigger: Calling setTextValue2 on the template scope, usually from generic variable-mutation utilities or code that second variable of a two-value variable type (e.g. query/enum variables) during batch delete.

Common situations: Reusable variable writer code applied to every VariableScope; attempts to normalize variable data while deleting instances; extension code assuming a writable 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/4f39c5f9ea8361af. Report an issue: GitHub.

Appendix: source

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

        @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();
            }
            return null;
        }

        @Override
        public void setLongValue(Long longValue) {
            throw new UnsupportedOperationException("Not supported to set long value");
        }

        @Override
        public Double getDoubleValue() {

View on GitHub (pinned to d6d39ce1c6)