{"record":{"id":"5223bb037fbd23ee","repo":"flowable/flowable-engine","slug":"cannot-change-fixed-value","errorCode":null,"errorMessage":"Cannot change fixed value","messagePattern":"Cannot change fixed value","errorType":"exception","errorClass":"ActivitiException","httpStatus":null,"severity":"error","filePath":"modules/flowable5-engine/src/main/java/org/activiti/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 ActivitiException(\"Cannot change fixed value\");\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/flowable5-engine/src/main/java/org/activiti/engine/impl/el/FixedValue.java#L23-L50","documentation":"FixedValue wraps a literal value injected into a delegate (e.g. a field on a JavaDelegate or a DelegateExpression) that is intentionally constant. Its setValue method always throws because a fixed value cannot be assigned at runtime. The library throws this to signal that someone is trying to write to what is a read-only, statically-configured expression.","triggerScenarios":"Calling setValue(...) on a FixedValue instance — typically the UEL/EL resolver assigning a variable into a delegate field whose configured expression is a literal (value=\"...\" in flow:field) rather than ${...} or #{...}.","commonSituations":"BPMN field injection with literal values being written back by the delegate, or framework code attempting to assign a value into an injected field expression that was configured as a constant.","solutions":["If the field should be assignable, change the BPMN field injection from a literal to an expression, e.g. <flow:field name=\"x\" expression=\"${myVar}\"/>.","Remove code/assignment attempts that write to fields configured as fixed values; treat them as constants.","Use an Expression instead of FixedValue when you need read-write semantics."],"exampleFix":"<!-- before: literal, not assignable -->\n<flow:field name=\"amount\" stringValue=\"100\"/>\n<!-- after: expression, assignable -->\n<flow:field name=\"amount\" expression=\"${amountVar}\"/>","handlingStrategy":"validation","validationCode":"// In a custom ELResolver or field-injection helper, reject writes to literal expressions:\nif (expression instanceof FixedValue) {\n  throw new IllegalArgumentException(\"Field 'x' is configured as a fixed literal and cannot be assigned\");\n}","typeGuard":"boolean isWritable(org.activiti.engine.impl.el.Expression e) {\n  return !(e instanceof org.activiti.engine.impl.el.FixedValue);\n}","tryCatchPattern":"try {\n  fixedValue.setValue(newValue, container);\n} catch (ActivitiException e) {\n  // value is a constant; use the expression's getValue instead\n}","preventionTips":["Treat literal field injections (stringValue=) as constants; never assign to them in delegates.","Use expression= (JUEL) instead of literals when a field must be updated.","Review delegate setters for assignments to injected fields."],"tags":["expression","field-injection","read-only"],"backgroundTag":"unsupported-operation","analyzedSha":"d6d39ce1c69ff244f2d9dc6af756a9b95e865586","analyzedAt":"2026-09-11T06:41:19.413Z","contentChangedAt":"2026-09-11T06:41:19.413Z","schemaVersion":2},"datasetVersion":"2026-09-18T11:17:12.947Z"}