{"record":{"id":"c1eff119bd07e5fb","repo":"apache/dubbo","slug":"key-doesn-t-map-to-a-integer-object","errorCode":null,"errorMessage":"'${key}' doesn't map to a Integer object","messagePattern":"'(.+?)' doesn't map to a Integer object","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"dubbo-common/src/main/java/org/apache/dubbo/common/config/Configuration.java","lineNumber":84,"sourceCode":"\n    default int getInt(String key, int defaultValue) {\n        Integer i = this.getInteger(key, null);\n        return i == null ? defaultValue : i;\n    }\n\n    default Integer getInteger(String key, Integer defaultValue) {\n        try {\n            return convert(Integer.class, key, defaultValue);\n        } catch (NumberFormatException e) {\n            // 0-2 Property type mismatch.\n            interfaceLevelLogger.error(\n                    COMMON_PROPERTY_TYPE_MISMATCH,\n                    \"typo in property value\",\n                    \"This property requires an integer value.\",\n                    \"Actual Class: \" + getClass().getName(),\n                    e);\n\n            throw new IllegalStateException('\\'' + key + \"' doesn't map to a Integer object\", e);\n        }\n    }\n\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 {","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-common/src/main/java/org/apache/dubbo/common/config/Configuration.java#L66-L102","documentation":"Thrown by Configuration.getInteger(key, defaultValue) when the configured value for key is present but cannot be parsed as an Integer. Internally, convert(Integer.class, key, defaultValue) throws NumberFormatException, which is caught, logged as COMMON_PROPERTY_TYPE_MISMATCH, and re-thrown wrapped in an IllegalStateException. The error indicates a typo or format error in a Dubbo property that is expected to be numeric.","triggerScenarios":"Calling configuration.getInteger(\"some.key\", defaultValue) where the resolved property value is non-numeric (e.g. \"abc\", \"12.5\", \"true\"). Also triggered indirectly by getInt(key) and getInt(key, defaultValue) which delegate to getInteger.","commonSituations":"Misspelled or mis-typed timeout, port, thread-count, or retry properties in dubbo.properties, application.yml, system properties (-D), or config-center. For example setting dubbo.protocol.port=auto or dubbo.consumer.retries=always. Environment variable overrides from CI/CD pipelines injecting wrong value types.","solutions":["Inspect the full property key from the exception message and check its configured value in dubbo.properties / application.yml / -D system property / config-center.","Correct the value to a valid integer literal (e.g. dubbo.consumer.retries=3 instead of dubbo.consumer.retries=three).","If the value is intentionally dynamic, read it as a String via configuration.getString(key) and parse it yourself with Integer.parseInt after validation.","Check the COMMON_PROPERTY_TYPE_MISMATCH log entry which prints the actual class and the original NumberFormatException for the exact value."],"exampleFix":"// before (in dubbo.properties)\ndubbo.protocol.threads=unlimited\n\n// after\ndubbo.protocol.threads=200","handlingStrategy":"try-catch","validationCode":"String raw = configuration.getString(key);\nif (raw == null) return defaultValue;\nif (!raw.matches(\"-?\\\\d+\")) {\n    // log and handle non-integer value before calling getInteger\n    return defaultValue;\n}","typeGuard":null,"tryCatchPattern":"try {\n    return configuration.getInteger(key, defaultValue);\n} catch (IllegalStateException e) {\n    if (e.getCause() instanceof NumberFormatException) {\n        logger.warn(\"Non-integer value for key {}, using default\", key);\n        return defaultValue;\n    }\n    throw e;\n}","preventionTips":["Always provide a sensible defaultValue when reading numeric configuration.","Validate property values at startup with a config-checking bean.","Use getString and parse yourself if the value format is uncertain."],"tags":["configuration","type-mismatch","properties"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}