{"record":{"id":"75cd8b6d6d50958e","repo":"apache/dubbo","slug":"try-to-get-key-failed-maybe-because-this-key","errorCode":null,"errorMessage":"Try to get '${key}' failed, maybe because this key doesn't map to a Boolean object","messagePattern":"Try to get '(.+?)' failed, maybe because this key doesn't map to a Boolean object","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"dubbo-common/src/main/java/org/apache/dubbo/common/config/Configuration.java","lineNumber":105,"sourceCode":"\n    default boolean getBoolean(String key) {\n        Boolean b = this.getBoolean(key, null);\n        if (b != null) {\n            return b;\n        } else {\n            throw new NoSuchElementException('\\'' + key + \"' doesn't map to an existing object\");\n        }\n    }\n\n    default boolean getBoolean(String key, boolean defaultValue) {\n        return this.getBoolean(key, toBooleanObject(defaultValue));\n    }\n\n    default Boolean getBoolean(String key, Boolean defaultValue) {\n        try {\n            return convert(Boolean.class, key, defaultValue);\n        } catch (Exception e) {\n            throw new IllegalStateException(\n                    \"Try to get \" + '\\'' + key + \"' failed, maybe because this key doesn't map to a Boolean object\", e);\n        }\n    }\n\n    /**\n     * Gets a property from the configuration. This is the most basic get\n     * method for retrieving values of properties. In a typical implementation\n     * of the {@code Configuration} interface the other get methods (that\n     * return specific data types) will internally make use of this method. On\n     * this level variable substitution is not yet performed. The returned\n     * object is an internal representation of the property value for the passed\n     * in key. It is owned by the {@code Configuration} object. So a caller\n     * should not modify this object. It cannot be guaranteed that this object\n     * will stay constant over time (i.e. further update operations on the\n     * configuration may change its internal state).\n     *\n     * @param key property to retrieve\n     * @return the value to which this configuration maps the specified key, or","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-common/src/main/java/org/apache/dubbo/common/config/Configuration.java#L87-L123","documentation":"Thrown by Configuration.getBoolean(key, Boolean defaultValue) when the value for key exists but cannot be converted to a Boolean. convert(Boolean.class, key, defaultValue) throws an Exception (e.g. the value is neither true nor false), which is caught and re-thrown as IllegalStateException. This is a type mismatch on a boolean-valued property, distinct from error 101 which is about missing keys.","triggerScenarios":"Calling configuration.getBoolean(key, defaultValue) where the resolved property value is a non-boolean string such as \"yes\", \"1\", \"on\", or \"maybe\". Dubbo's Boolean converter only accepts \"true\"/\"false\" (case-insensitive).","commonSituations":"Setting boolean Dubbo properties using shell-style truthy values (yes/no, on/off, 1/0) instead of Java boolean literals. Common when migrating from other frameworks or when environment variables from infrastructure tools use non-Java-boolean conventions.","solutions":["Change the configured value to a literal true or false (case-insensitive).","If the value must be a truthy string, read it with getString(key) and map it yourself: \"yes\"/\"1\"/\"on\" -> true.","Check the original Exception cause chained in the IllegalStateException for the exact value that failed conversion."],"exampleFix":"// before (in application.yml)\ndubbo:\n  consumer:\n    check: yes\n\n// after\ndubbo:\n  consumer:\n    check: true","handlingStrategy":"validation","validationCode":"String raw = configuration.getString(key);\nif (raw != null && !raw.equalsIgnoreCase(\"true\") && !raw.equalsIgnoreCase(\"false\")) {\n    // value is present but not boolean; sanitize or reject\n    return defaultValue;\n}","typeGuard":null,"tryCatchPattern":"try {\n    return configuration.getBoolean(key, defaultValue);\n} catch (IllegalStateException e) {\n    logger.warn(\"Non-boolean value for key {}, using default\", key);\n    return defaultValue;\n}","preventionTips":["Only use true/false (case-insensitive) for boolean properties.","If environment provides yes/no or 1/0, map them to true/false before Dubbo reads them.","Add a config validation step in CI to catch malformed boolean values."],"tags":["configuration","type-mismatch","boolean","properties"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}