{"record":{"id":"f09f39741debc128","repo":"alibaba/nacos","slug":"http-client-invalid-connect-timeout","errorCode":null,"errorMessage":"[http-client] invalid connect timeout:{}","messagePattern":"\\[http-client\\] invalid connect timeout:(.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"critical","filePath":"client/src/main/java/com/alibaba/nacos/client/utils/ParamUtil.java","lineNumber":72,"sourceCode":"        LOGGER.info(\"[settings] [http-client] connect timeout:{}\", connectTimeout);\n        \n        readTimeout = initReadTimeout();\n        LOGGER.info(\"[settings] [http-client] read timeout:{}\", readTimeout);\n        \n        perTaskConfigSize = initPerTaskConfigSize();\n        LOGGER.info(\"PER_TASK_CONFIG_SIZE: {}\", perTaskConfigSize);\n    }\n    \n    private static int initConnectionTimeout() {\n        String tmp = DEFAULT_NACOS_CONNECT_TIMEOUT;\n        try {\n            tmp = NacosClientProperties.PROTOTYPE.getProperty(NACOS_CONNECT_TIMEOUT_KEY,\n                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 {","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/client/src/main/java/com/alibaba/nacos/client/utils/ParamUtil.java#L54-L90","documentation":"Thrown during static initialization of ParamUtil when the NACOS.CONNECT.TIMEOUT property is set to a non-integer value (IllegalArgumentException). ParamUtil reads the timeout from NacosClientProperties, parses it with Integer.parseInt, and fails fast if the value is not a valid integer. This is a JVM-startup-time error — the exception propagates from the static initializer, causing the ParamUtil class to fail initialization.","triggerScenarios":"Setting the system property or environment variable NACOS.CONNECT.TIMEOUT to a non-numeric string (e.g., 'abc', '1s', ''). The default value '1000' is used if the property is absent, so this only fires when an explicit invalid value is provided.","commonSituations":"Misconfigured JVM system property (-DNACOS.CONNECT.TIMEOUT=2s with a unit suffix); environment variable with a typo or wrong format; a properties file with an incorrect timeout value; copy-paste from documentation that includes units.","solutions":["Set NACOS.CONNECT.TIMEOUT to a plain integer (milliseconds), e.g., -DNACOS.CONNECT.TIMEOUT=2000.","Remove the property entirely to use the default (1000ms).","Check all property sources (system properties, environment variables, nacos-client.properties file) for an incorrect NACOS.CONNECT.TIMEOUT value."],"exampleFix":"# before\n-DNACOS.CONNECT.TIMEOUT=2s\n\n# after\n-DNACOS.CONNECT.TIMEOUT=2000","handlingStrategy":"validation","validationCode":"// Validate before JVM startup — check all property sources\nString timeout = System.getProperty(\"NACOS.CONNECT.TIMEOUT\");\nif (timeout != null) {\n    try {\n        Integer.parseInt(timeout);\n    } catch (NumberFormatException e) {\n        throw new IllegalArgumentException(\n            \"NACOS.CONNECT.TIMEOUT must be an integer (milliseconds), got: \" + timeout);\n    }\n}","typeGuard":null,"tryCatchPattern":"// This error occurs during class static initialization and cannot be\n// caught at the call site — it fails the ParamUtil class load.\n// Fix the property value before starting the JVM.\n// No runtime try-catch is effective here.","preventionTips":["Set NACOS.CONNECT.TIMEOUT to a plain integer in milliseconds (e.g., 2000).","Do not include unit suffixes (s, ms) in the property value.","Audit all property sources (system properties, env vars, nacos-client.properties) for invalid timeout values.","Remove the property to use the default (1000ms) if unsure of the correct value."],"tags":["configuration","timeout","startup","validation","client"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}