{"record":{"id":"fa72272750b976bf","repo":"alibaba/nacos","slug":"param-servicename-is-illegal-servicename-is-bla","errorCode":null,"errorMessage":"Param 'serviceName' is illegal, serviceName is blank","messagePattern":"Param 'serviceName' is illegal, serviceName is blank","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/com/alibaba/nacos/api/naming/utils/NamingUtils.java","lineNumber":63,"sourceCode":"    \n    private static final Pattern NUMBER_PATTERN = Pattern.compile(NUMBER_PATTERN_STRING);\n    \n    /**\n     * Returns a combined string with serviceName and groupName. serviceName can not be nil.\n     *\n     * <p>In most cases, serviceName can not be nil. In other cases, for search or anything, See {@link\n     * com.alibaba.nacos.api.naming.utils.NamingUtils#getGroupedNameOptional(String, String)}\n     *\n     * <p>etc:\n     * <p>serviceName | groupName | result</p>\n     * <p>serviceA    | groupA    | groupA@@serviceA</p>\n     * <p>nil         | groupA    | threw IllegalArgumentException</p>\n     *\n     * @return 'groupName@@serviceName'\n     */\n    public static String getGroupedName(final String serviceName, final String groupName) {\n        if (StringUtils.isBlank(serviceName)) {\n            throw new IllegalArgumentException(\n                \"Param 'serviceName' is illegal, serviceName is blank\");\n        }\n        if (StringUtils.isBlank(groupName)) {\n            throw new IllegalArgumentException(\"Param 'groupName' is illegal, groupName is blank\");\n        }\n        final String resultGroupedName = groupName + Constants.SERVICE_INFO_SPLITER + serviceName;\n        return resultGroupedName.intern();\n    }\n    \n    public static String getServiceKey(String namespace, String group, String serviceName) {\n        if (StringUtils.isBlank(namespace)) {\n            namespace = DEFAULT_NAMESPACE_ID;\n        }\n        return namespace + Constants.SERVICE_INFO_SPLITER + group + Constants.SERVICE_INFO_SPLITER\n            + serviceName;\n    }\n    \n    /**","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/api/src/main/java/com/alibaba/nacos/api/naming/utils/NamingUtils.java#L45-L81","documentation":"NamingUtils.getGroupedName composes the canonical 'group@@service' identifier and refuses a blank serviceName up front. The composite key would be ambiguous without it, so the method fails fast with IllegalArgumentException.","triggerScenarios":"Calling getGroupedName(\"\", \"DEFAULT_GROUP\"), getGroupedName(null, group), or with a whitespace-only serviceName.","commonSituations":"Client registerInstance invoked with an empty serviceName form field; building a key from a config value that resolved to blank.","solutions":["Provide a non-blank serviceName.","Validate serviceName at the entry point (form/controller) before composing the grouped name."],"exampleFix":"// before\nString key = NamingUtils.getGroupedName(userInput, \"DEFAULT_GROUP\");  // userInput==\"\" throws 542\n\n// after\nif (StringUtils.isBlank(userInput)) throw new IllegalArgumentException(\"serviceName required\");\nString key = NamingUtils.getGroupedName(userInput, \"DEFAULT_GROUP\");","handlingStrategy":"validation","validationCode":"if (StringUtils.isBlank(serviceName)) {\n    throw new IllegalArgumentException(\"serviceName is required before composing grouped name\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Guard user input before composing grouped names.","Treat a blank serviceName as a programming error at the entry point."],"tags":["naming","validation","parameter","service-key"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}