flowable/flowable-engine · error · UnsupportedOperationException

Setting localized name is not supported for read only delega

Error message

Setting localized name is not supported for read only delegate execution

What it means

ReadOnlyDelegatePlanItemInstance forbids all state mutation; setLocalizedName throws UnsupportedOperationException because changing the localized display name would modify case model state during a read-only delegate execution.

Source

Thrown at modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/delegate/ReadOnlyDelegatePlanItemInstance.java:48

            return planItem.getPlanItemDefinition();
        }

        return null;
    }

    @Override
    default void setVariable(String variableName, Object variableValue) {
        throw new UnsupportedOperationException("Setting variable is not supported for read only delegate execution");
    }

    @Override
    default void setTransientVariable(String variableName, Object variableValue) {
        throw new UnsupportedOperationException("Setting transient variable is not supported for read only delegate execution");
    }

    @Override
    default void setLocalizedName(String localizedName) {
        throw new UnsupportedOperationException("Setting localized name is not supported for read only delegate execution");
    }
}

View on GitHub (pinned to d6d39ce1c6)

Solutions

  1. Remove the setLocalizedName call in read-only contexts
  2. Guard the write with an instanceof ReadOnlyDelegatePlanItemInstance check
  3. Set the localized name at design time in the CMMN model or via a writable delegate context

Example fix

// before
planItemInstance.setLocalizedName("My Task " + suffix);
// after
if (!(planItemInstance instanceof ReadOnlyDelegatePlanItemInstance)) {
    planItemInstance.setLocalizedName("My Task " + suffix);
}
Defensive patterns

Strategy: type-guard

Validate before calling

boolean canRename = !(planItemInstance instanceof ReadOnlyDelegatePlanItemInstance);

Type guard

if (planItemInstance instanceof ReadOnlyDelegatePlanItemInstance) return; // no mutation allowed

Try / catch

try { planItemInstance.setLocalizedName(name); } catch (UnsupportedOperationException e) { log.warn("Cannot set localized name in read-only context"); }

Prevention

When it happens

Trigger: Calling setLocalizedName(...) on the DelegatePlanItemInstance inside a read-only delegate execution (e.g. lifecycle/audit listeners that receive read-only plan item instances).

Common situations: Attempting dynamic renaming of a plan item from a listener; porting code that customized names in a writable context to a read-only listener.

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/533aaf1f840eff7f. Report an issue: GitHub.