{"record":{"id":"b50b3d8ed6cb922c","repo":"alibaba/nacos","slug":"illegal-format-must-be-type-version-but-got","errorCode":null,"errorMessage":"illegal format, must be 'type:version', but got: {value}","messagePattern":"illegal format, must be 'type:version', but got: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"warning","filePath":"naming/src/main/java/com/alibaba/nacos/naming/misc/SwitchManager.java","lineNumber":134,"sourceCode":"            if (entry.equals(SwitchEntry.DISTRO_THRESHOLD)) {\n                float threshold = Float.parseFloat(value);\n                if (threshold <= 0) {\n                    throw new IllegalArgumentException(\n                        \"distroThreshold can not be zero or negative: \" + threshold);\n                }\n                tempSwitchDomain.setDistroThreshold(threshold);\n            }\n            \n            if (entry.equals(SwitchEntry.CLIENT_BEAT_INTERVAL)) {\n                long clientBeatInterval = Long.parseLong(value);\n                tempSwitchDomain.setClientBeatInterval(clientBeatInterval);\n            }\n            \n            if (entry.equals(SwitchEntry.PUSH_VERSION)) {\n                \n                String[] parts = value.split(\":\");\n                if (parts.length < 2) {\n                    throw new IllegalArgumentException(\n                        \"illegal format, must be 'type:version', but got: \" + value);\n                }\n                String type = parts[0];\n                String version = parts[1];\n                \n                if (!version.matches(UtilsAndCommons.VERSION_STRING_SYNTAX)) {\n                    throw new IllegalArgumentException(\n                        \"illegal version, must match: \" + UtilsAndCommons.VERSION_STRING_SYNTAX);\n                }\n                \n                if (StringUtils.equals(SwitchEntry.CLIENT_JAVA, type)) {\n                    tempSwitchDomain.setPushJavaVersion(version);\n                } else if (StringUtils.equals(SwitchEntry.CLIENT_PYTHON, type)) {\n                    tempSwitchDomain.setPushPythonVersion(version);\n                } else if (StringUtils.equals(SwitchEntry.CLIENT_C, type)) {\n                    tempSwitchDomain.setPushCVersion(version);\n                } else if (StringUtils.equals(SwitchEntry.CLIENT_GO, type)) {\n                    tempSwitchDomain.setPushGoVersion(version);","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/naming/src/main/java/com/alibaba/nacos/naming/misc/SwitchManager.java#L116-L152","documentation":"Thrown by SwitchManager.update when the 'pushVersion' switch entry value is split on ':' and produces fewer than 2 parts. The expected format is 'type:version' (e.g. 'java:1.4.2'). An IllegalArgumentException is raised. This guard ensures the push-version switch, which controls per-client-type push protocol versions, has a parseable type and version segment.","triggerScenarios":"Calling the switch-update API with entry='pushVersion' and a value missing the colon separator, e.g. 'java' or '1.4.2' alone, or an empty string. The split(':') yields a single-element array, triggering the length < 2 guard.","commonSituations":"Operator passes only the version or only the type. Copy-paste error omitting the colon. Automation script formatting the value without the separator.","solutions":["Format the value as 'type:version', e.g. 'java:1.4.2', 'python:1.0.0', 'go:1.0.0', 'c:1.0.0', 'csharp:1.0.0'.","Validate the input contains exactly one ':' before calling update.","Use one of the supported types: java, python, c, go, csharp."],"exampleFix":"// before\nswitchManager.update(\"pushVersion\", \"java\", false);\n\n// after\nswitchManager.update(\"pushVersion\", \"java:1.4.2\", false);","handlingStrategy":"validation","validationCode":"String value = \"java:1.4.2\"; // expected format\nString[] parts = value.split(\":\");\nif (parts.length < 2) {\n    throw new IllegalArgumentException(\"pushVersion must be 'type:version'\");\n}\nswitchManager.update(\"pushVersion\", value, false);","typeGuard":null,"tryCatchPattern":"try {\n    switchManager.update(\"pushVersion\", value, false);\n} catch (IllegalArgumentException e) {\n    // malformed pushVersion — log and reject\n    logger.error(\"Invalid pushVersion format: {}\", value);\n}","preventionTips":["Always format pushVersion as 'type:version' with a colon separator.","Validate the input contains a ':' before calling update.","Use supported types only: java, python, c, go, csharp."],"tags":["naming","switch","push-version","format","validation","configuration"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}