{"record":{"id":"5515afef31a90d75","repo":"flowable/flowable-engine","slug":"cannot-change-fixed-value-with","errorCode":null,"errorMessage":"Cannot change fixed value with ","messagePattern":"Cannot change fixed value with ","errorType":"exception","errorClass":"FlowableException","httpStatus":null,"severity":"error","filePath":"modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/FixedValue.java","lineNumber":41,"sourceCode":" * @author Frederik Heremans\n */\npublic class FixedValue implements Expression {\n\n    private static final long serialVersionUID = 1L;\n    private Object value;\n\n    public FixedValue(Object value) {\n        this.value = value;\n    }\n    \n    @Override\n    public Object getValue(VariableContainer variableContainer) {\n        return value;\n    }\n    \n    @Override\n    public void setValue(Object value, VariableContainer variableContainer) {\n        throw new FlowableException(\"Cannot change fixed value with \" + variableContainer);\n    }\n\n    @Override\n    public String getExpressionText() {\n        return value.toString();\n    }\n\n}\n","sourceCodeStart":23,"sourceCodeEnd":50,"githubUrl":"https://github.com/flowable/flowable-engine/blob/d6d39ce1c69ff244f2d9dc6af756a9b95e865586/modules/flowable-engine-common/src/main/java/org/flowable/common/engine/impl/el/FixedValue.java#L23-L50","documentation":"FixedValue is a read-only EL value expression wrapper (e.g. used for a literal in a variable mapping). Its setValue() is intentionally unimplemented: assigning to a fixed value is not a supported operation, so it always throws this FlowableException naming the VariableContainer that attempted the write.","triggerScenarios":"Expression language or Flowable's variable-scope code attempts to write through a ValueExpression backed by FixedValue, e.g. ${'literal'} used as a writable expression in an activity field, task variable mapping, or delegate code calling setValue() on it.","commonSituations":"Misconfigured process XML where a literal expression is placed in a destination/writable slot (task assignee write-back, out-mapping); delegate code unconditionally calling expression.setValue(...) without checking writability; copy-pasted setValue boilerplate on a constant.","solutions":["Use a writable expression (a variable reference like ${myVar}) instead of a literal FixedValue where assignment happens","Guard writes: only call setValue on expressions that are actually variable references","Fix the BPMN XML so the literal appears only on the source/read side of a mapping","If you own the code, remove the setValue call or wrap FixedValue in a read-only check via isReadOnly() before writing"],"exampleFix":"// before\nexpression.setValue(newValue, variableContainer); // throws\n// after\nif (!expression.isReadOnly(variableContainer)) {\n    expression.setValue(newValue, variableContainer);\n}","handlingStrategy":"type-guard","validationCode":"// before writing through an expression\nif (expression instanceof FixedValue) {\n    throw new IllegalArgumentException(\"Cannot assign to a fixed/literal expression\");\n}\n// or check writability first\nboolean writable = !expression.isReadOnly(variableContainer);","typeGuard":"boolean isWritable = (expr instanceof FixedValue) == false;\nif (!isWritable) { /* skip write or fail fast */ }","tryCatchPattern":"try {\n    expression.setValue(newValue, variableContainer);\n} catch (FlowableException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Cannot change fixed value\")) {\n        logger.warn(\"Attempted write to a fixed value expression; ignoring\");\n    } else {\n        throw e;\n    }\n}","preventionTips":["Never put literal expressions (${'...'} or constants) in writable/out-mapping slots in BPMN XML","Check isReadOnly before calling setValue on any ValueExpression","Use variable references for anything the engine needs to write back"],"tags":["el","read-only","unsupported-operation","flowable"],"backgroundTag":"unsupported-operation","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}