{"record":{"id":"4bcf951eaf951139","repo":"alibaba/nacos","slug":"unsupported-client-type-type","errorCode":null,"errorMessage":"unsupported client type: {type}","messagePattern":"unsupported client type: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"naming/src/main/java/com/alibaba/nacos/naming/misc/SwitchManager.java","lineNumber":156,"sourceCode":"                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);\n                } else if (StringUtils.equals(SwitchEntry.CLIENT_CSHARP, type)) {\n                    tempSwitchDomain.setPushCSharpVersion(version);\n                } else {\n                    throw new IllegalArgumentException(\"unsupported client type: \" + type);\n                }\n            }\n            \n            if (entry.equals(SwitchEntry.PUSH_CACHE_MILLIS)) {\n                long cacheMillis = Long.parseLong(value);\n                \n                if (cacheMillis < SwitchEntry.MIN_PUSH_CACHE_TIME_MIILIS) {\n                    throw new IllegalArgumentException(\n                        \"min cache time for http or tcp is too small(<10000)\");\n                }\n                \n                tempSwitchDomain.setDefaultPushCacheMillis(cacheMillis);\n            }\n            \n            // extremely careful while modifying this, cause it will affect all clients without pushing enabled\n            if (entry.equals(SwitchEntry.DEFAULT_CACHE_MILLIS)) {\n                long cacheMillis = Long.parseLong(value);\n                ","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/naming/src/main/java/com/alibaba/nacos/naming/misc/SwitchManager.java#L138-L174","documentation":"Thrown by SwitchManager.update when entry is 'pushVersion' and the value's client-type segment does not match any of the five supported types: java, python, c, go, csharp. The value must be formatted as 'type:version' (split on ':'); the type part is compared case-sensitively via StringUtils.equals. Only those exact five lowercase tokens are accepted.","triggerScenarios":"PUT /v3/admin/ns/operator/switches with entry=pushVersion and value using an unsupported type prefix, e.g. value='ruby:1.0.0', value='node:2.0.0', value='JS:1.0.0' (case mismatch), or value='JavaScript:1.0.0'.","commonSituations":"Misspelling a language name, using wrong case (e.g. 'Java' instead of 'java'), using a language Nacos does not track for push-version filtering, or confusing the type:version delimiter with some other separator.","solutions":["Use one of the five supported types exactly as lowercase: java, python, c, go, csharp.","Ensure value format is 'type:version' with a single colon, e.g. 'java:3.0.0'.","Check SwitchEntry constants (java='java', python='python', c='c', go='go', csharp='csharp') for the exact token."],"exampleFix":"// before\nPUT /v3/admin/ns/operator/switches?entry=pushVersion&value=Ruby:1.0.0\n// after\nPUT /v3/admin/ns/operator/switches?entry=pushVersion&value=java:3.0.0","handlingStrategy":"validation","validationCode":"String[] SUPPORTED = {\"java\",\"python\",\"c\",\"go\",\"csharp\"};\nString type = value.split(\":\")[0];\nif (!Arrays.asList(SUPPORTED).contains(type)) {\n    throw new IllegalArgumentException(\"Unsupported client type: \" + type\n        + \". Must be one of: \" + Arrays.toString(SUPPORTED));\n}","typeGuard":"function isSupportedClientType(type: string): boolean {\n  return ['java','python','c','go','csharp'].includes(type);\n}","tryCatchPattern":"try {\n  operatorV2Impl.updateSwitch(\"pushVersion\", type + \":\" + version, debug);\n} catch (NacosApiException e) {\n  if (e.getMessage().contains(\"unsupported client type\")) {\n    // log and prompt user with valid types\n  }\n  throw e;\n}","preventionTips":["Maintain a whitelist of the five supported types in your calling code.","Validate the type:version format before calling the API."],"tags":["naming","switch","validation","push-version"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}