{"record":{"id":"a94fa12edf252278","repo":"apache/flink","slug":"value-for-config-option-s-must-be-one-of-s-was","errorCode":null,"errorMessage":"Value for config option %s must be one of %s (was %s)","messagePattern":"Value for config option (.+?) must be one of (.+?) \\(was (.+?)\\)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/configuration/Configuration.java","lineNumber":215,"sourceCode":"     *     be parsed as a value of the provided enum class.\n     */\n    @PublicEvolving\n    public <T extends Enum<T>> T getEnum(\n            final Class<T> enumClass, final ConfigOption<String> configOption) {\n        checkNotNull(enumClass, \"enumClass must not be null\");\n        checkNotNull(configOption, \"configOption must not be null\");\n\n        Object rawValue = getRawValueFromOption(configOption).orElseGet(configOption::defaultValue);\n        try {\n            return ConfigurationUtils.convertToEnum(rawValue, enumClass);\n        } catch (IllegalArgumentException ex) {\n            final String errorMessage =\n                    String.format(\n                            \"Value for config option %s must be one of %s (was %s)\",\n                            configOption.key(),\n                            Arrays.toString(enumClass.getEnumConstants()),\n                            rawValue);\n            throw new IllegalArgumentException(errorMessage);\n        }\n    }\n\n    // --------------------------------------------------------------------------------------------\n\n    /**\n     * Returns the keys of all key/value pairs stored inside this configuration object.\n     *\n     * @return the keys of all key/value pairs stored inside this configuration object\n     */\n    public Set<String> keySet() {\n        synchronized (this.confData) {\n            return new HashSet<>(this.confData.keySet());\n        }\n    }\n\n    /** Adds all entries in this {@code Configuration} to the given {@link Properties}. */\n    public void addAllToProperties(Properties props) {","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L197-L233","documentation":"Configuration.getEnum(enumClass, configOption) converts the raw configured value into a constant of the given enum via ConfigurationUtils.convertToEnum. When the string does not equal (case-sensitively) any enum constant name, conversion throws and Flink rethrows IllegalArgumentException listing the option key, the allowed enum constants, and the offending value.","triggerScenarios":"Setting e.g. 'execution.retry-policy: alwys' (typo), using wrong case ('EXACTLY_ONCE' vs expected spelling), providing an empty value, or a stale value after an enum constant was renamed between Flink versions.","commonSituations":"Hand-edited flink-conf.yaml / config map with a typo'd enum value; upgrading Flink where an option's allowed values changed; passing enum options via -Dkey=value on the CLI with a value that no longer exists.","solutions":["Correct the value to exactly one of the enum constants printed in the message (match spelling; note whether upper or lower case is required — convertToEnum is case-sensitive).","Check the option's documentation for its allowed values in your Flink version.","Remove the key to fall back to the option's default.","In YAML, quote the value if tooling mangles case."],"exampleFix":"# before (flink-conf.yaml)\nexecution.checkpointing-consistency: exacly_once  # typo\n\n# after\nexecution.checkpointing-consistency: EXACTLY_ONCE","handlingStrategy":"validation","validationCode":"static <E extends Enum<E>> boolean isValidEnumValue(Class<E> enumClass, String value) {\n    for (E constant : enumClass.getEnumConstants()) {\n        if (constant.name().equals(value)) return true;\n    }\n    return false;\n}\n// if (!isValidEnumValue(ConsistencyMode.class, conf.getString(key))) -> reject before getEnum","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate enum-valued config at application startup and list allowed values in the error.","Remember conversion is case-sensitive: match the enum constant spelling exactly.","Watch release notes when upgrading — allowed enum values change between versions."],"tags":["configuration","enum","validation","flink-core"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}