{"record":{"id":"21afd68b0fc373b1","repo":"conductor-oss/conductor","slug":"env-backed-environment-variables-are-read-only","errorCode":null,"errorMessage":"env-backed environment variables are read-only","messagePattern":"env-backed environment variables are read-only","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"warning","filePath":"core/src/main/java/com/netflix/conductor/core/env/EnvVariableEnvironmentDAO.java","lineNumber":47,"sourceCode":"        havingValue = \"env\",\n        matchIfMissing = true)\npublic class EnvVariableEnvironmentDAO implements EnvironmentDAO {\n\n    private final String prefix;\n\n    public EnvVariableEnvironmentDAO(\n            @Value(\"${conductor.environment.env.prefix:CONDUCTOR_ENV_}\") String prefix) {\n        this.prefix = prefix;\n    }\n\n    @Override\n    public String getEnvVariable(String key) {\n        return EnvVarLookup.lookup(prefix, key);\n    }\n\n    @Override\n    public void setEnvVariable(String key, String value) {\n        throw new UnsupportedOperationException(\"env-backed environment variables are read-only\");\n    }\n\n    @Override\n    public void delete(String key) {\n        throw new UnsupportedOperationException(\"env-backed environment variables are read-only\");\n    }\n\n    @Override\n    public List<EnvironmentVariable> getAll() {\n        List<EnvironmentVariable> result = new ArrayList<>();\n        for (Map.Entry<String, String> e : EnvVarLookup.allWithPrefix(prefix).entrySet()) {\n            result.add(EnvironmentVariable.of(e.getKey(), e.getValue()));\n        }\n        return result;\n    }\n}\n","sourceCodeStart":29,"sourceCodeEnd":64,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/core/src/main/java/com/netflix/conductor/core/env/EnvVariableEnvironmentDAO.java#L29-L64","documentation":"Thrown by EnvVariableEnvironmentDAO.setEnvVariable. This DAO backs the EnvironmentDAO with read-only process environment variables (filtered by the CONDUCTOR_ENV_ prefix). Because the OS process environment cannot be mutated at runtime, writes are permanently rejected. It is the default impl (matchIfMissing=true when conductor.environment.type is unset or 'env').","triggerScenarios":"Any code path that calls environmentDAO.setEnvVariable(key, value) while the env-backed DAO is active — e.g. an API endpoint or SDK call that tries to create/update an environment variable.","commonSituations":"A client tries to set an environment variable through the API not realizing the server is using the env-backed (read-only) DAO. A test that exercises setEnvVariable against the default profile. Confusion between Conductor 'environment variables' (runtime config values) and OS env vars.","solutions":["If you need writable environment variables, switch conductor.environment.type to a writable backend (e.g. a DB-backed DAO) instead of the default 'env'.","Do not call setEnvVariable against the env-backed DAO; provision variables in the process environment (CONDUCTOR_ENV_* keys) before startup.","Guard API/UI code to hide the write action when the DAO is the read-only variant."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Only call set if the DAO is writable\nif (!isReadOnlyEnvDao(environmentDAO)) {\n    environmentDAO.setEnvVariable(key, value);\n}","typeGuard":null,"tryCatchPattern":"try {\n    environmentDAO.setEnvVariable(key, value);\n} catch (UnsupportedOperationException e) {\n    // read-only env-backed DAO -> provision via process env instead\n}","preventionTips":["Know which EnvironmentDAO impl is active before issuing writes.","Provision CONDUCTOR_ENV_* variables in the process environment rather than via runtime writes.","Switch to a writable DAO if runtime writes are required."],"tags":["environment-variables","read-only","configuration","unsupported-operation"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}