{"record":{"id":"2dbd74ff076e6024","repo":"apache/flink","slug":"unrecognized-option-for-boolean-s-expected-eith","errorCode":null,"errorMessage":"Unrecognized option for boolean: %s. Expected either true or false(case insensitive)","messagePattern":"Unrecognized option for boolean: (.+?)\\. Expected either true or false\\(case insensitive\\)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/configuration/ConfigurationUtils.java","lineNumber":562,"sourceCode":"        } else if (o.getClass() == Integer.class) {\n            return ((Integer) o).longValue();\n        }\n\n        return Long.parseLong(o.toString());\n    }\n\n    static Boolean convertToBoolean(Object o) {\n        if (o.getClass() == Boolean.class) {\n            return (Boolean) o;\n        }\n\n        switch (o.toString().toUpperCase()) {\n            case \"TRUE\":\n                return true;\n            case \"FALSE\":\n                return false;\n            default:\n                throw new IllegalArgumentException(\n                        String.format(\n                                \"Unrecognized option for boolean: %s. Expected either true or false(case insensitive)\",\n                                o));\n        }\n    }\n\n    static Float convertToFloat(Object o) {\n        if (o.getClass() == Float.class) {\n            return (Float) o;\n        } else if (o.getClass() == Double.class) {\n            double value = ((Double) o);\n            if (value == 0.0\n                    || (value >= Float.MIN_VALUE && value <= Float.MAX_VALUE)\n                    || (value >= -Float.MAX_VALUE && value <= -Float.MIN_VALUE)) {\n                return (float) value;\n            } else {\n                throw new IllegalArgumentException(\n                        String.format(","sourceCodeStart":544,"sourceCodeEnd":580,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/configuration/ConfigurationUtils.java#L544-L580","documentation":"Thrown by convertToBoolean when the raw value's string form (upper-cased) is neither TRUE nor FALSE. Boolean conversion only accepts the exact strings 'true' and 'false' in any case.","triggerScenarios":"Setting a Boolean ConfigOption to values like 'yes', 'no', '1', '0', 'on', 'off', or any non-'true'/'false' string. The conversion switch has no default numeric or alternative keyword handling.","commonSituations":"Coming from environments that accept yes/no or 1/0 for booleans. Shell variable expansion leaving an empty string. Copy-pasting config from other systems (e.g., systemd-style 'on').","solutions":["Use exactly 'true' or 'false' (case-insensitive) as the config value.","If an empty string is the cause, ensure the env variable is actually set before it reaches Flink.","Convert yes/no or 1/0 style inputs to true/false upstream in your deployment scripts."],"exampleFix":"# before\nmy.flag: yes\n\n# after\nmy.flag: true","handlingStrategy":"validation","validationCode":"String v = rawValue.trim();\nif (!v.equalsIgnoreCase(\"true\") && !v.equalsIgnoreCase(\"false\")) {\n    throw new IllegalArgumentException(\"Not a boolean: \" + v);\n}","typeGuard":"static boolean isFlinkBoolean(String s) {\n    return s != null && (s.equalsIgnoreCase(\"true\") || s.equalsIgnoreCase(\"false\"));\n}","tryCatchPattern":"try {\n    config.set(boolOption, rawValue);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"Unrecognized option for boolean\")) { /* normalize */ }\n}","preventionTips":["Use only 'true'/'false' for boolean config values.","Normalize yes/no/on/off to true/false in deployment scripts.","Ensure env vars are set to avoid empty-string booleans."],"tags":["configuration","type-conversion","boolean"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}