{"record":{"id":"e18d8e9bab49f892","repo":"alibaba/nacos","slug":"do-not-support-query-instance-by-http-client-pleas","errorCode":null,"errorMessage":"Do not support query instance by http client,please use gRPC replaced.","messagePattern":"Do not support query instance by http client,please use gRPC replaced\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"client/src/main/java/com/alibaba/nacos/client/naming/remote/http/NamingHttpClientProxy.java","lineNumber":219,"sourceCode":"        params.put(CommonParams.NAMESPACE_ID, namespaceId);\n        params.put(CommonParams.SERVICE_NAME, serviceName);\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(ENABLE_PARAM, String.valueOf(instance.isEnabled()));\n        params.put(EPHEMERAL_PARAM, String.valueOf(instance.isEphemeral()));\n        params.put(META_PARAM, JsonUtils.toJson(instance.getMetadata()));\n        \n        reqApi(UtilAndComs.nacosUrlInstance, params, HttpMethod.PUT);\n    }\n    \n    @Override\n    public ServiceInfo queryInstancesOfService(String serviceName, String groupName,\n        String clusters,\n        boolean healthyOnly) {\n        throw new UnsupportedOperationException(\n            \"Do not support query instance by http client,please use gRPC replaced.\");\n    }\n    \n    @Override\n    public Service queryService(String serviceName, String groupName) throws NacosException {\n        NAMING_LOGGER.info(\"[QUERY-SERVICE] {} query service : {}, {}\", namespaceId, serviceName,\n            groupName);\n        \n        final Map<String, String> params = new HashMap<>(16);\n        params.put(CommonParams.NAMESPACE_ID, namespaceId);\n        params.put(CommonParams.SERVICE_NAME, serviceName);\n        params.put(CommonParams.GROUP_NAME, groupName);\n        \n        String result = reqApi(UtilAndComs.nacosUrlService, params, HttpMethod.GET);\n        return JsonUtils.toObj(result, Service.class);\n    }\n    \n    @Override","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/client/src/main/java/com/alibaba/nacos/client/naming/remote/http/NamingHttpClientProxy.java#L201-L237","documentation":"Thrown by NamingHttpClientProxy.queryInstancesOfService (UnsupportedOperationException). Querying the full instance list of a service (with cluster and healthyOnly filters) is not implemented for the HTTP naming proxy — it requires gRPC.","triggerScenarios":"Calling queryInstancesOfService on a NamingService backed by the HTTP client proxy. This is a less commonly used API that the HTTP proxy deliberately omits.","commonSituations":"Application uses queryInstancesOfService and the NamingService was created with HTTP transport; migrating from gRPC to HTTP without checking API compatibility.","solutions":["Use the gRPC naming client proxy for instance list queries.","If HTTP is required, use selectInstances or getAllInstances which may have HTTP support, depending on version.","Confirm the transport is gRPC in the NamingService factory configuration."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Use getAllInstances as an alternative for HTTP transport\nif (isHttpTransport(namingService)) {\n    List<Instance> all = namingService.getAllInstances(serviceName, groupName, clusters);\n    // filter healthyOnly manually\n} else {\n    ServiceInfo info = namingServiceProxy.queryInstancesOfService(serviceName, groupName, clusters, healthyOnly);\n}","typeGuard":null,"tryCatchPattern":"try {\n    ServiceInfo info = namingServiceProxy.queryInstancesOfService(serviceName, groupName, clusters, healthyOnly);\n} catch (UnsupportedOperationException e) {\n    if (e.getMessage().contains(\"query instance by http\")) {\n        List<Instance> all = namingService.getAllInstances(serviceName, groupName, clusters);\n        // apply healthyOnly filter manually\n    } else {\n        throw e;\n    }\n}","preventionTips":["Use the gRPC transport for queryInstancesOfService.","For HTTP deployments, use getAllInstances and filter client-side.","Document which query APIs are available per transport."],"tags":["naming","http-proxy","query","unsupported","client"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}