{"record":{"id":"6d96ca7c738eeb42","repo":"alibaba/nacos","slug":"http-client-invalid-read-timeout","errorCode":null,"errorMessage":"[http-client] invalid read timeout:{}","messagePattern":"\\[http-client\\] invalid read timeout:(.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"critical","filePath":"client/src/main/java/com/alibaba/nacos/client/utils/ParamUtil.java","lineNumber":85,"sourceCode":"                DEFAULT_NACOS_CONNECT_TIMEOUT);\n            return Integer.parseInt(tmp);\n        } catch (NumberFormatException e) {\n            final String msg = \"[http-client] invalid connect timeout:\" + tmp;\n            LOGGER.error(\"[settings] \" + msg, e);\n            throw new IllegalArgumentException(msg, e);\n        }\n    }\n    \n    private static int initReadTimeout() {\n        String tmp = DEFAULT_NACOS_READ_TIMEOUT;\n        try {\n            tmp = NacosClientProperties.PROTOTYPE.getProperty(NACOS_READ_TIMEOUT_KEY,\n                DEFAULT_NACOS_READ_TIMEOUT);\n            return Integer.parseInt(tmp);\n        } catch (NumberFormatException e) {\n            final String msg = \"[http-client] invalid read timeout:\" + tmp;\n            LOGGER.error(\"[settings] \" + msg, e);\n            throw new IllegalArgumentException(msg, e);\n        }\n    }\n    \n    private static double initPerTaskConfigSize() {\n        try {\n            return Double.parseDouble(\n                NacosClientProperties.PROTOTYPE.getProperty(PER_TASK_CONFIG_SIZE_KEY,\n                    DEFAULT_PER_TASK_CONFIG_SIZE_KEY));\n        } catch (NumberFormatException e) {\n            LOGGER.error(\"[PER_TASK_CONFIG_SIZE] PER_TASK_CONFIG_SIZE invalid\", e);\n            throw new IllegalArgumentException(\n                \"invalid PER_TASK_CONFIG_SIZE, expected value type double\", e);\n        }\n    }\n    \n    public static int getConnectTimeout() {\n        return connectTimeout;\n    }","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/client/src/main/java/com/alibaba/nacos/client/utils/ParamUtil.java#L67-L103","documentation":"Thrown by ParamUtil.initReadTimeout() during static class initialization when the NACOS.READ.TIMEOUT property cannot be parsed as an integer via Integer.parseInt. The default value is \"3000\" (ms), so this only fires when an explicit override is non-numeric. Because it runs in a static initializer block (line 56), the exception propagates as ExceptionInInitializerError and prevents the entire ParamUtil class — and therefore the Nacos client — from loading.","triggerScenarios":"Setting -DNACOS.READ.TIMEOUT=abc or a JVM system property / environment variable with a non-integer value (e.g. \"3s\", \"3,000\", empty string with whitespace). Also triggered by passing Properties containing NACOS.READ.TIMEOUT with a garbage value to NacosClientProperties.","commonSituations":"Operators copy-paste a timeout like \"3000ms\" instead of \"3000\"; YAML files inject quotes that produce non-numeric strings; CI pipelines set environment variables with units appended; migration from Spring property sources where unit-suffixed Duration values (e.g. \"3s\") leak into the Nacos property namespace.","solutions":["Check the full stack trace for ExceptionInInitializerError wrapping this IllegalArgumentException — the offending value is in the message.","Inspect all configured sources of NACOS.READ.TIMEOUT: JVM -D flags, environment variables, nacos-client.properties files, and any NacosClientProperties.setProperty calls.","Change the value to a plain integer in milliseconds (e.g. 3000); remove unit suffixes like 'ms' or 's'.","If a Duration-style value is desired upstream, convert it to milliseconds before passing it into NacosClientProperties."],"exampleFix":"// before\nSystem.setProperty(\"NACOS.READ.TIMEOUT\", \"3000ms\");\n\n// after\nSystem.setProperty(\"NACOS.READ.TIMEOUT\", \"3000\");","handlingStrategy":"validation","validationCode":"String rawTimeout = System.getProperty(\"NACOS.READ.TIMEOUT\", \"3000\");\ntry {\n    Integer.parseInt(rawTimeout);\n} catch (NumberFormatException e) {\n    throw new IllegalStateException(\"NACOS.READ.TIMEOUT must be an integer, got: \" + rawTimeout, e);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate all NACOS.* numeric properties at application startup before the Nacos client loads ParamUtil.","Document that timeout values are raw milliseconds with no unit suffix.","Use a configuration validation layer in your application to catch malformed properties early."],"tags":["configuration","client-init","timeout","static-initializer"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}