{"record":{"id":"932be95ce8f888e0","repo":"Activiti/Activiti","slug":"error-value-set-rvalue-932be9","errorCode":"error.value.set.rvalue","errorMessage":"Cannot set value of a non-lvalue expression ''{0}''","messagePattern":"Cannot set value of a non-lvalue expression ''(.+?)''","errorType":"exception","errorClass":"ELException","httpStatus":null,"severity":"error","filePath":"activiti-core-common/activiti-juel-jakarta/src/main/java/org/activiti/core/el/juel/tree/impl/ast/AstText.java","lineNumber":54,"sourceCode":"\n    public boolean isLeftValue() {\n        return false;\n    }\n\n    public boolean isMethodInvocation() {\n        return false;\n    }\n\n    public Class<?> getType(Bindings bindings, ELContext context) {\n        return null;\n    }\n\n    public boolean isReadOnly(Bindings bindings, ELContext context) {\n        return true;\n    }\n\n    public void setValue(Bindings bindings, ELContext context, Object value) {\n        throw new ELException(LocalMessages.get(\"error.value.set.rvalue\", getStructuralId(bindings)));\n    }\n\n    public ValueReference getValueReference(Bindings bindings, ELContext context) {\n        return null;\n    }\n\n    @Override\n    public Object eval(Bindings bindings, ELContext context) {\n        return value;\n    }\n\n    public MethodInfo getMethodInfo(Bindings bindings, ELContext context, Class<?> returnType, Class<?>[] paramTypes) {\n        return null;\n    }\n\n    public Object invoke(\n        Bindings bindings,\n        ELContext context,","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/Activiti/Activiti/blob/56435b1a97deeafdc09dd40074b056c89fba5a8a/activiti-core-common/activiti-juel-jakarta/src/main/java/org/activiti/core/el/juel/tree/impl/ast/AstText.java#L36-L72","documentation":"In Activiti JUEL, AstText nodes represent literal text in an EL expression and are always read-only. setValue() is implemented to unconditionally throw ELException because a literal has no writable storage; assigning a value to it is meaningless.","triggerScenarios":"Calling ExpressionFactory.createValueExpression(literalText, ...) and then invoking setValue() on the resulting ValueExpression, e.g. elFactory.createValueExpression(context, \"'hello'\", Object.class).setValue(ctx, newValue) where the expression parses to an AstText node rather than an identifier or property.","commonSituations":"Templates or dynamically built expressions where a variable name was accidentally quoted or the expression is plain text; code that assumes any ValueExpression is writable; refactoring that swapped a #{bean.property} expression for a literal string.","solutions":["Ensure the expression actually resolves to a variable or property (e.g. ${myBean.value}), not a literal or plain text.","Use createValueExpression with a proper identifier/property expression before calling setValue().","Check isReadOnly() on the ValueExpression before calling setValue() and handle read-only expressions gracefully."],"exampleFix":"// before\nValueExpression ve = factory.createValueExpression(ctx, \"'static text'\", String.class);\nve.setValue(ctx, \"new value\"); // throws\n\n// after\nValueExpression ve = factory.createValueExpression(ctx, \"${myBean.text}\", String.class);\nve.setValue(ctx, \"new value\");","handlingStrategy":"try-catch","validationCode":"if (expr instanceof ValueExpression && !((ValueExpression) expr).isReadOnly(ctx)) { /* safe to setValue */ }","typeGuard":"boolean isWritable(ValueExpression ve, ELContext ctx) { return ve != null && !ve.isReadOnly(ctx); }","tryCatchPattern":"try { ve.setValue(ctx, value); } catch (ELException e) { log.warn(\"Expression is read-only (literal): {}\", ve.getExpressionString()); }","preventionTips":["Always call isReadOnly() before setValue().","Never attempt to assign to literal/text expressions.","Build expressions from identifiers/properties, not raw strings."],"tags":["el","juel","read-only","expression-language"],"backgroundTag":"unsupported-operation","analyzedSha":"56435b1a97deeafdc09dd40074b056c89fba5a8a","analyzedAt":"2026-09-09T21:00:06.703Z","contentChangedAt":"2026-09-09T21:00:06.703Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}