{"record":{"id":"21f6ba2110c2a4ea","repo":"alibaba/nacos","slug":"do-not-support-persistent-instances-to-perform-bat-21f6ba","errorCode":null,"errorMessage":"Do not support persistent instances to perform batch de registration methods.","messagePattern":"Do not support persistent instances to perform batch de registration methods\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"client/src/main/java/com/alibaba/nacos/client/naming/remote/http/NamingHttpClientProxy.java","lineNumber":169,"sourceCode":"        params.put(WEIGHT_PARAM, String.valueOf(instance.getWeight()));\n        params.put(REGISTER_ENABLE_PARAM, String.valueOf(instance.isEnabled()));\n        params.put(HEALTHY_PARAM, String.valueOf(instance.isHealthy()));\n        params.put(EPHEMERAL_PARAM, String.valueOf(instance.isEphemeral()));\n        params.put(META_PARAM, JsonUtils.toJson(instance.getMetadata()));\n        reqApi(UtilAndComs.nacosUrlInstance, params, HttpMethod.POST);\n    }\n    \n    @Override\n    public void batchRegisterService(String serviceName, String groupName,\n        List<Instance> instances) {\n        throw new UnsupportedOperationException(\n            \"Do not support persistent instances to perform batch registration methods.\");\n    }\n    \n    @Override\n    public void batchDeregisterService(String serviceName, String groupName,\n        List<Instance> instances) {\n        throw new UnsupportedOperationException(\n            \"Do not support persistent instances to perform batch de registration methods.\");\n    }\n    \n    @Override\n    public void deregisterService(String serviceName, String groupName, Instance instance)\n        throws NacosException {\n        NAMING_LOGGER.info(\"[DEREGISTER-SERVICE] {} deregistering service {} with instance: {}\",\n            namespaceId,\n            serviceName, instance);\n        if (instance.isEphemeral()) {\n            return;\n        }\n        final Map<String, String> params = new HashMap<>(16);\n        params.put(CommonParams.NAMESPACE_ID, namespaceId);\n        params.put(CommonParams.SERVICE_NAME, NamingUtils.getGroupedName(serviceName, groupName));\n        params.put(CommonParams.CLUSTER_NAME, instance.getClusterName());\n        params.put(IP_PARAM, instance.getIp());\n        params.put(PORT_PARAM, String.valueOf(instance.getPort()));","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/client/src/main/java/com/alibaba/nacos/client/naming/remote/http/NamingHttpClientProxy.java#L151-L187","documentation":"Thrown unconditionally by NamingHttpClientProxy.batchDeregisterService (UnsupportedOperationException). Batch deregistration, like batch registration, is only available on the gRPC naming client proxy.","triggerScenarios":"Calling batchDeregisterService on a NamingService backed by the HTTP client proxy.","commonSituations":"Same as batch registration: HTTP-configured client or code ported from a gRPC deployment without adjusting transport.","solutions":["Switch to the gRPC naming client proxy to use batch deregistration.","If HTTP is required, deregister instances individually with deregisterService.","Verify the client transport configuration to ensure gRPC is active."],"exampleFix":"// before — HTTP proxy does not support batch deregister\nnamingService.batchDeregisterService(serviceName, groupName, instances);\n\n// after — deregister individually over HTTP\nfor (Instance inst : instances) {\n    namingService.deregisterInstance(serviceName, groupName, inst);\n}","handlingStrategy":"fallback","validationCode":"if (isHttpTransport(namingService)) {\n    for (Instance inst : instances) {\n        namingService.deregisterInstance(serviceName, groupName, inst);\n    }\n} else {\n    namingService.batchDeregisterService(serviceName, groupName, instances);\n}","typeGuard":null,"tryCatchPattern":"try {\n    namingService.batchDeregisterService(serviceName, groupName, instances);\n} catch (UnsupportedOperationException e) {\n    if (e.getMessage().contains(\"batch de registration\")) {\n        for (Instance inst : instances) {\n            namingService.deregisterInstance(serviceName, groupName, inst);\n        }\n    } else {\n        throw e;\n    }\n}","preventionTips":["Use gRPC transport for batch deregistration.","Implement an individual-deregister fallback for HTTP deployments.","Verify transport compatibility before calling batch APIs."],"tags":["naming","http-proxy","batch-deregister","unsupported","client"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}