diff --git a/naming/src/main/java/com/alibaba/nacos/naming/controllers/ServiceController.java b/naming/src/main/java/com/alibaba/nacos/naming/controllers/ServiceController.java index ebbc17388..0c8deda77 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/controllers/ServiceController.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/controllers/ServiceController.java @@ -158,7 +158,10 @@ public class ServiceController { List doms = domainsManager.getAllDomNamesList(namespaceId); if (doms == null || doms.isEmpty()) { - throw new NacosException(NacosException.INVALID_PARAM, "No service exist in " + namespaceId); + JSONObject result = new JSONObject(); + result.put("doms", new ArrayList<>()); + result.put("count", 0); + return result; } if (StringUtils.isNotBlank(selectorString)) {