{"record":{"id":"633323affb4adc53","repo":"apache/flink","slug":"not-allowed-configuration-change-s-were-detected","errorCode":null,"errorMessage":"Not allowed configuration change(s) were detected:\\n - {errorMessages}","messagePattern":"Not allowed configuration change\\(s\\) were detected:\\\\n - (.+?)","errorType":"exception","errorClass":"MutatedConfigurationException","httpStatus":null,"severity":"error","filePath":"flink-clients/src/main/java/org/apache/flink/client/program/StreamContextEnvironment.java","lineNumber":340,"sourceCode":"                            applicationId,\n                            userJarInfo,\n                            allRecoveredJobInfos);\n                };\n        initializeContextEnvironment(factory);\n    }\n\n    public static void unsetAsContext() {\n        resetContextEnvironment();\n    }\n\n    // --------------------------------------------------------------------------------------------\n    // Program Configuration Validation\n    // --------------------------------------------------------------------------------------------\n\n    private void checkNotAllowedConfigurations() throws MutatedConfigurationException {\n        final Collection<String> errorMessages = collectNotAllowedConfigurations();\n        if (!errorMessages.isEmpty()) {\n            throw new MutatedConfigurationException(errorMessages);\n        }\n    }\n\n    /**\n     * Collects programmatic configuration changes.\n     *\n     * <p>For supporting wildcards, the first can be accomplished by simply removing keys, the\n     * latter by setting equal fields before comparison.\n     */\n    private Collection<String> collectNotAllowedConfigurations() {\n        if (programConfigEnabled) {\n            return Collections.emptyList();\n        }\n\n        final List<String> errors = new ArrayList<>();\n\n        final Configuration clusterConfigMap = new Configuration(clusterConfiguration);\n","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-clients/src/main/java/org/apache/flink/client/program/StreamContextEnvironment.java#L322-L358","documentation":"Thrown by checkNotAllowedConfigurations when the program (user code) has mutated cluster-level configuration options that are not in the allowed wildcard list. This protects against user jobs silently changing cluster-critical settings. The MutatedConfigurationException carries a collection of error messages listing each disallowed change.","triggerScenarios":"User job code modifies Configuration options that differ from the cluster-provided configuration, and programConfigEnabled is false (or the changed key is not covered by programConfigWildcards). The comparison happens at executeAsync time before job submission.","commonSituations":"User code calls streamExecEnv.getConfig().disableSysoutLogging() or sets a config option that conflicts with cluster policy, or the deployment enforces a locked configuration and the job tries to override checkpointing, parallelism, or state backend settings.","solutions":["Set DeploymentOptions.PROGRAM_CONFIG_ENABLED=true if programmatic config changes should be allowed.","Add the specific config key prefix to DeploymentOptions.PROGRAM_CONFIG_WILDCARDS to whitelist it.","Remove the programmatic configuration change from user code and set it at the cluster/deployment level instead.","Review the error message (it lists each disallowed key) and reconcile each one."],"exampleFix":"// before: user code changes a locked config\nenv.getConfig().setString(\"execution.checkpointing.interval\", \"30s\");\n// throws MutatedConfigurationException\n\n// after: allow programmatic config changes in deployment config\nconfig.set(DeploymentOptions.PROGRAM_CONFIG_ENABLED, true);\n// or whitelist the specific key\nconfig.set(DeploymentOptions.PROGRAM_CONFIG_WILDCARDS,\n    Collections.singletonList(\"execution.checkpointing.interval\"));","handlingStrategy":"validation","validationCode":"// check before executeAsync whether programmatic config changes are allowed\nif (!clusterConfig.get(DeploymentOptions.PROGRAM_CONFIG_ENABLED)) {\n    // diff user config vs cluster config and verify each changed key\n    // is covered by PROGRAM_CONFIG_WILDCARDS\n}","typeGuard":null,"tryCatchPattern":"try {\n    env.executeAsync(streamGraph);\n} catch (MutatedConfigurationException e) {\n    // e carries a Collection<String> of disallowed config changes\n    // reconcile each key or enable program config\n    for (String msg : e.getErrorMessages()) {\n        LOG.warn(\"Disallowed config change: {}\", msg);\n    }\n    throw e;\n}","preventionTips":["Set cluster-level configuration options at deployment time, not in user code.","If programmatic config is needed, set PROGRAM_CONFIG_ENABLED=true or add keys to PROGRAM_CONFIG_WILDCARDS.","Document which config keys are safe to override in user jobs."],"tags":["stream-context-environment","configuration","validation","mutated-config","security"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}