{"record":{"id":"b0d1900378129028","repo":"alibaba/nacos","slug":"param-servicename-is-illegal-it-should-be-forma","errorCode":null,"errorMessage":"Param 'serviceName' is illegal, it should be format as 'groupName@@serviceName'","messagePattern":"Param 'serviceName' is illegal, it should be format as 'groupName@@serviceName'","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/com/alibaba/nacos/api/naming/utils/NamingUtils.java","lineNumber":136,"sourceCode":"        return !StringUtils.isBlank(serviceName)\n            && serviceName.contains(Constants.SERVICE_INFO_SPLITER);\n    }\n    \n    /**\n     * check combineServiceName format. the serviceName can't be blank.\n     * <pre>\n     * serviceName = \"@@\";                 the length = 0; illegal\n     * serviceName = \"group@@\";            the length = 1; illegal\n     * serviceName = \"@@serviceName\";      the length = 2; illegal\n     * serviceName = \"group@@serviceName\"; the length = 2; legal\n     * </pre>\n     *\n     * @param combineServiceName such as: groupName@@serviceName\n     */\n    public static void checkServiceNameFormat(String combineServiceName) {\n        String[] split = combineServiceName.split(Constants.SERVICE_INFO_SPLITER);\n        if (split.length <= 1) {\n            throw new IllegalArgumentException(\n                \"Param 'serviceName' is illegal, it should be format as 'groupName@@serviceName'\");\n        }\n        if (split[0].isEmpty()) {\n            throw new IllegalArgumentException(\n                \"Param 'serviceName' is illegal, groupName can't be empty\");\n        }\n    }\n    \n    /**\n     * Returns a combined string with serviceName and groupName. Such as 'groupName@@serviceName'\n     * <p>This method works similar with {@link com.alibaba.nacos.api.naming.utils.NamingUtils#getGroupedName} But not\n     * verify any parameters.\n     *\n     * </p> etc:\n     * <p>serviceName | groupName | result</p>\n     * <p>serviceA    | groupA    | groupA@@serviceA</p>\n     * <p>nil         | groupA    | groupA@@</p>\n     * <p>nil         | nil       | @@</p>","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/api/src/main/java/com/alibaba/nacos/api/naming/utils/NamingUtils.java#L118-L154","documentation":"checkServiceNameFormat validates a combined 'group@@name' string. If splitting on '@@' yields one or zero parts (no separator at all), the format is wrong and IllegalArgumentException is thrown.","triggerScenarios":"Passing a bare serviceName ('my-service') where the API expects the combined form; unsubscribe/selectInstances with a non-grouped name.","commonSituations":"Mixing up serviceName and groupedServiceName across client APIs; older client behavior that auto-grouped now requiring explicit group.","solutions":["Pass the combined 'group@@name' form.","Build the combined name with NamingUtils.getGroupedName(service, group) before calling APIs that require the combined form."],"exampleFix":"// before\nNamingUtils.checkServiceNameFormat(\"my-service\");  // throws 544\n\n// after\nNamingUtils.checkServiceNameFormat(\"DEFAULT_GROUP@@my-service\");","handlingStrategy":"validation","validationCode":"if (combineServiceName == null || !combineServiceName.contains(Constants.SERVICE_INFO_SPLITER)) {\n    throw new IllegalArgumentException(\"expected 'group@@name' form\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build combined names via NamingUtils.getGroupedName rather than hand-concatenating.","Document clearly which client APIs take the combined form vs. plain serviceName."],"tags":["naming","validation","service-key","format"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}