{"record":{"id":"4ee3ca63d595141d","repo":"alibaba/nacos","slug":"do-not-support-persistent-instances-to-perform-bat","errorCode":null,"errorMessage":"Do not support persistent instances to perform batch registration methods.","messagePattern":"Do not support persistent instances to perform batch 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":162,"sourceCode":"        final Map<String, String> params = new HashMap<>(32);\n        params.put(CommonParams.NAMESPACE_ID, namespaceId);\n        params.put(CommonParams.SERVICE_NAME, groupedServiceName);\n        params.put(CommonParams.GROUP_NAME, 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()));\n        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;","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/client/src/main/java/com/alibaba/nacos/client/naming/remote/http/NamingHttpClientProxy.java#L144-L180","documentation":"Thrown unconditionally by NamingHttpClientProxy.batchRegisterService (UnsupportedOperationException). Batch registration is not implemented for the HTTP naming proxy — it only exists on the gRPC proxy. The message references persistent instances because the HTTP proxy is the persistent-instance path.","triggerScenarios":"Calling batchRegisterService on a NamingService that is backed by the HTTP client proxy. This happens when the client is explicitly configured for HTTP or when only persistent instances are expected.","commonSituations":"Application calls batchRegisterService but the NamingService was created with HTTP transport; code copied from a gRPC example into an HTTP-configured deployment.","solutions":["Use the gRPC naming client proxy — batch registration requires gRPC.","If stuck on HTTP, register instances individually with registerService and setEphemeral(false).","Ensure the Nacos client version is 2.x+ and gRPC is the active transport."],"exampleFix":"// before — HTTP proxy does not support batch\nnamingService.batchRegisterService(serviceName, groupName, instances);\n\n// after — register individually over HTTP with persistent instances\nfor (Instance inst : instances) {\n    inst.setEphemeral(false);\n    namingService.registerInstance(serviceName, groupName, inst);\n}","handlingStrategy":"fallback","validationCode":"// Check transport before using batch APIs\nif (isHttpTransport(namingService)) {\n    // fall back to individual register\n    for (Instance inst : instances) {\n        inst.setEphemeral(false);\n        namingService.registerInstance(serviceName, groupName, inst);\n    }\n} else {\n    namingService.batchRegisterService(serviceName, groupName, instances);\n}","typeGuard":null,"tryCatchPattern":"try {\n    namingService.batchRegisterService(serviceName, groupName, instances);\n} catch (UnsupportedOperationException e) {\n    if (e.getMessage().contains(\"batch registration\")) {\n        // HTTP proxy — fall back to individual registration\n        for (Instance inst : instances) {\n            inst.setEphemeral(false);\n            namingService.registerInstance(serviceName, groupName, inst);\n        }\n    } else {\n        throw e;\n    }\n}","preventionTips":["Use the gRPC transport if batch registration is required.","Maintain a fallback path that registers instances individually if the transport does not support batch.","Check the Nacos client version — batch registration requires 2.x+ with gRPC."],"tags":["naming","http-proxy","batch-register","unsupported","client"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}