flowable/flowable-engine · error · UnsupportedOperationException

Not supported to set long value

Error message

Not supported to set long value

What it means

Deliberate unsupported-operation sentinel: in batch deletion the variable is a read-only JSON-backed snapshot, so mutation methods like setLongValue are hard-wired to throw; it fires only if code tries to modify such a projection.

Solutions

  1. Update numeric variables through runtimeService.setVariable on the live process instance before deleting
  2. Use the read-only getters (getLongValue) which are backed by the JSON node
  3. Defensively catch UnsupportedOperationException when writing to arbitrary VariableScope implementations
  4. Provide a writable scope subclass for custom batch-delete flows

Example fix

// before
batchScope.setLongValue(42L); // throws
// after
runtimeService.setVariable(processInstanceId, "count", 42L); // live instance only
Defensive patterns

Strategy: validation

Validate before calling

// guard numeric writes
if (scope instanceof org.flowable.engine.impl.delete.BatchDeleteProcessConfig.DeleteVariableScope) {
    throw new IllegalStateException("Read-only scope; use runtimeService.setVariable for long values");
}
scope.setLongValue(longValue);

Try / catch

try {
    scope.setLongValue(v);
} catch (UnsupportedOperationException e) {
    runtimeService.setVariable(processInstanceId, varName, v);
}

Prevention

When it happens

Trigger: Calling setLongValue on the template scope from variable-mutation code reused during batch delete configuration or execution.

Common situations: Generic variable setter utilities; attempts to adjust numeric variable data as part of cleanup; code that assumed the scope is a live execution 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/ab9ec6709da5299f. Report an issue: GitHub.

Appendix: source

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

        }

        @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() {
            JsonNode doubleNode = node.path("doubleValue");
            if (doubleNode.isNumber()) {
                return doubleNode.doubleValue();
            }
            return null;
        }

        @Override
        public void setDoubleValue(Double doubleValue) {
            throw new UnsupportedOperationException("Not supported to set double value");
        }

        @Override
        public byte[] getBytes() {

View on GitHub (pinned to d6d39ce1c6)