{"record":{"id":"1d91394edcdb709c","repo":"Activiti/Activiti","slug":"environment-variables-are-read-only","errorCode":null,"errorMessage":"Environment variables are read-only","messagePattern":"Environment variables are read-only","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"activiti-core/activiti-spring-boot-starter/src/main/java/org/activiti/spring/resolver/EnvironmentVariableELResolver.java","lineNumber":47,"sourceCode":"            context.setPropertyResolved(true);\n            return new EnvVar();\n        }\n        if (base instanceof EnvVar && property != null) {\n            String env = System.getenv(VAR_PREFIX_WITH_DOT + property);\n            context.setPropertyResolved(true);\n            return env;\n        }\n        return null;\n    }\n\n    @Override\n    public Class<?> getType(ELContext elContext, Object o, Object o1) {\n        return String.class;\n    }\n\n    @Override\n    public void setValue(ELContext elContext, Object o, Object o1, Object o2) {\n        throw new UnsupportedOperationException(\"Environment variables are read-only\");\n    }\n\n    @Override\n    public boolean isReadOnly(ELContext elContext, Object o, Object o1) {\n        return true;\n    }\n\n    @Override\n    public Class<?> getCommonPropertyType(ELContext elContext, Object o) {\n        return String.class;\n    }\n}\n","sourceCodeStart":29,"sourceCodeEnd":60,"githubUrl":"https://github.com/Activiti/Activiti/blob/56435b1a97deeafdc09dd40074b056c89fba5a8a/activiti-core/activiti-spring-boot-starter/src/main/java/org/activiti/spring/resolver/EnvironmentVariableELResolver.java#L29-L60","documentation":"EnvironmentVariableELResolver is a read-only EL resolver that maps identifiers to OS environment variables during expression evaluation. Its setValue() unconditionally throws UnsupportedOperationException because mutating environment variables through EL is not allowed. Any expression that attempts to assign to a resolved environment variable triggers this.","triggerScenarios":"Evaluating a process expression that performs an assignment targeting an identifier that resolves to an environment variable (e.g. ${someEnvVar = 'x'} in a script/expression evaluated by the Activiti EL context).","commonSituations":"Accidentally writing to a variable whose name collides with an environment variable name, misunderstanding the resolver as writable, or copy-pasting assignment expressions from other contexts.","solutions":["Remove the assignment from the expression; read environment variables only, and store mutable data in process/executions variables.","Use execution.setVariable() or runtimeService.setVariable() instead of EL assignment.","Rename the target variable if it unintentionally collides with an environment variable name."],"exampleFix":"// before (process expression)\n${PATH = '/new/path'}\n// after (Java)\nexecution.setVariable(\"targetVar\", \"/new/path\");","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    elResolver.setValue(elContext, base, property, value);\n} catch (UnsupportedOperationException e) {\n    log.warn(\"EL attempted to write an environment variable; use process variables instead\", e);\n}","preventionTips":["Treat EL resolvers backed by environment/config as read-only by design.","Never write assignments to environment-variable-like identifiers in process expressions.","Use execution.setVariable() for mutable process state.","Avoid naming process variables the same as environment variables."],"tags":["el","read-only","environment-variables","unsupported-operation"],"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"}