alibaba/nacos · warning · NacosApiException
SERVICE_NOT_EXIST
SERVICE_NOT_EXIST
Error message
service %s is not exist.
What it means
Thrown by ServiceInnerHandler.updateService when the target service is not present in the ServiceManager singleton for the given namespace/group/serviceName. It raises NacosApiException with NacosException.NOT_FOUND (HTTP 404) and ErrorCode.SERVICE_NOT_EXIST. The update only applies to an existing service.
Source
Thrown at console/src/main/java/com/alibaba/nacos/console/handler/impl/inner/naming/ServiceInnerHandler.java:105
@Override
public void deleteService(String namespaceId, String serviceName, String groupName)
throws Exception {
serviceOperatorV2.delete(
com.alibaba.nacos.naming.core.v2.pojo.Service.newService(namespaceId, groupName,
serviceName));
NotifyCenter.publishEvent(
new DeregisterServiceTraceEvent(System.currentTimeMillis(), namespaceId, groupName,
serviceName));
}
@Override
public void updateService(ServiceForm serviceForm, ServiceMetadata serviceMetadata)
throws Exception {
Service service =
Service.newService(serviceForm.getNamespaceId(), serviceForm.getGroupName(),
serviceForm.getServiceName());
if (!ServiceManager.getInstance().containSingleton(service)) {
throw new NacosApiException(NacosException.NOT_FOUND, ErrorCode.SERVICE_NOT_EXIST,
"service %s is not exist.".formatted(service.toString()));
}
service = ServiceManager.getInstance().getSingleton(service);
serviceOperatorV2.update(service, serviceMetadata);
NotifyCenter.publishEvent(
new UpdateServiceTraceEvent(System.currentTimeMillis(), serviceForm.getNamespaceId(),
serviceForm.getGroupName(), serviceForm.getServiceName(),
serviceMetadata.getExtendData()));
}
@Override
public List<String> getSelectorTypeList() throws NacosException {
return selectorManager.getAllSelectorTypes();
}
@Override
public Page<SubscriberInfo> getSubscribers(int pageNo, int pageSize, String namespaceId,
String serviceName,View on GitHub (pinned to 9b989acdf1)
Solutions
- Verify the service exists in the exact namespaceId/groupName/serviceName before updating (query the service list/detail).
- If the service does not exist, create it first via the create-service API.
- Double-check namespace, group, and service name spelling/casing.
Example fix
// before
handler.updateService(form, metadata); // service does not exist
// after
Service key = Service.newService(ns, group, serviceName);
if (!ServiceManager.getInstance().containSingleton(key)) {
handler.createService(form); // create first
}
handler.updateService(form, metadata); Defensive patterns
Strategy: validation
Validate before calling
// Verify the service exists before updating it
Service key = Service.newService(form.getNamespaceId(), form.getGroupName(), form.getServiceName());
if (!ServiceManager.getInstance().containSingleton(key)) {
throw new NoSuchResourceException("service not found: " + key);
}
handler.updateService(form, metadata); Type guard
// Java: boolean guard that the service singleton exists
boolean serviceExists = ServiceManager.getInstance()
.containSingleton(Service.newService(ns, group, serviceName)); Try / catch
try {
handler.updateService(form, metadata);
} catch (NacosApiException e) {
if (e.getErrCode() == NacosException.NOT_FOUND) {
handler.createService(form); // create then retry update
handler.updateService(form, metadata);
} else { throw e; }
} Prevention
- Check service existence in the exact namespace/group/serviceName before updating.
- Create the service first if it does not exist.
- Re-fetch the service list right before an update to avoid race with deletes.
When it happens
Trigger: Calling the service-update API for a service that has never been registered, was deleted, or whose namespace/group/serviceName does not match any singleton.
Common situations: Updating a service in the wrong namespace; service was removed between list and update; mistyped group or serviceName; persistent service never created.
Related errors
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/3f31ecf610b9ed65.
Report an issue: GitHub.