{"record":{"id":"2cfabd874176f060","repo":"alibaba/nacos","slug":"url-can-not-be-empty-url-limitedurl","errorCode":null,"errorMessage":"url can not be empty, url: {limitedUrl}","messagePattern":"url can not be empty, url: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"naming/src/main/java/com/alibaba/nacos/naming/misc/SwitchManager.java","lineNumber":256,"sourceCode":"                boolean sendBeatOnly = Boolean.parseBoolean(value);\n                \n                tempSwitchDomain.setSendBeatOnly(sendBeatOnly);\n            }\n            \n            if (entry.equals(SwitchEntry.LIMITED_URL_MAP)) {\n                Map<String, Integer> limitedUrlMap = new HashMap<>(16);\n                \n                if (!StringUtils.isEmpty(value)) {\n                    String[] entries = value.split(\",\");\n                    for (String each : entries) {\n                        String[] parts = each.split(\":\");\n                        if (parts.length < 2) {\n                            throw new IllegalArgumentException(\"invalid input for limited urls\");\n                        }\n                        \n                        String limitedUrl = parts[0];\n                        if (StringUtils.isEmpty(limitedUrl)) {\n                            throw new IllegalArgumentException(\n                                \"url can not be empty, url: \" + limitedUrl);\n                        }\n                        \n                        int statusCode = Integer.parseInt(parts[1]);\n                        if (statusCode <= 0) {\n                            throw new IllegalArgumentException(\n                                \"illegal normal status code: \" + statusCode);\n                        }\n                        \n                        limitedUrlMap.put(limitedUrl, statusCode);\n                        \n                    }\n                    \n                    tempSwitchDomain.setLimitedUrlMap(limitedUrlMap);\n                }\n            }\n            \n            if (entry.equals(SwitchEntry.ENABLE_STANDALONE)) {","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/naming/src/main/java/com/alibaba/nacos/naming/misc/SwitchManager.java#L238-L274","documentation":"Thrown when entry is 'limitedUrlMap' and an entry's URL part (before ':') is empty. This happens when the value starts with ':' or has '::', e.g. ':200'. The URL string must be non-empty.","triggerScenarios":"PUT /v3/admin/ns/operator/switches with entry=limitedUrlMap and value where the URL segment is blank, e.g. value=':200', value='/ok:200,:500'.","commonSituations":"Leading/trailing commas producing empty URL parts, or typo like '::404'.","solutions":["Ensure every URL segment before ':' is non-empty.","Remove stray commas or leading colons from the value."],"exampleFix":"// before\nPUT /v3/admin/ns/operator/switches?entry=limitedUrlMap&value=:200\n// after\nPUT /v3/admin/ns/operator/switches?entry=limitedUrlMap&value=/nacos:200","handlingStrategy":"validation","validationCode":"for (String entry : value.split(\",\")) {\n    String[] parts = entry.split(\":\", 2);\n    if (parts.length < 2 || parts[0].isEmpty()) {\n        throw new IllegalArgumentException(\"URL part cannot be empty\");\n    }\n}","typeGuard":"function hasNoEmptyUrl(value: string): boolean {\n  return value.split(',').every(e => {\n    const idx = e.indexOf(':');\n    return idx > 0;\n  });\n}","tryCatchPattern":"try {\n  operatorV2Impl.updateSwitch(\"limitedUrlMap\", value, debug);\n} catch (NacosApiException e) {\n  if (e.getMessage().contains(\"url can not be empty\")) {\n    value = value.replace(/(^|,),/g, '$1').replace(/^:/, '');\n  }\n}","preventionTips":["Trim leading/trailing commas from the value.","Ensure no entry starts with ':'. "],"tags":["naming","switch","validation","limited-url"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}