{"record":{"id":"354c14685bf8a1f1","repo":"grpc/grpc-java","slug":"address-is-not-an-ip","errorCode":null,"errorMessage":"Address is not an IP","messagePattern":"Address is not an IP","errorType":"validation","errorClass":"ResourceInvalidException","httpStatus":null,"severity":"error","filePath":"xds/src/main/java/io/grpc/xds/XdsEndpointResource.java","lineNumber":256,"sourceCode":"      endpoints.add(Endpoints.LbEndpoint.create(\n          new EquivalentAddressGroup(addresses),\n          endpoint.getLoadBalancingWeight().getValue(), isHealthy,\n          endpoint.getEndpoint().getHostname(),\n          endpointMetadata));\n    }\n    return StructOrError.fromStruct(Endpoints.LocalityLbEndpoints.create(\n        endpoints, proto.getLoadBalancingWeight().getValue(),\n        proto.getPriority(), localityMetadata));\n  }\n\n  private static InetSocketAddress getInetSocketAddress(Address address)\n      throws ResourceInvalidException {\n    io.envoyproxy.envoy.config.core.v3.SocketAddress socketAddress = address.getSocketAddress();\n    InetAddress parsedAddress;\n    try {\n      parsedAddress = InetAddresses.forString(socketAddress.getAddress());\n    } catch (IllegalArgumentException ex) {\n      throw new ResourceInvalidException(\"Address is not an IP\", ex);\n    }\n    return new InetSocketAddress(parsedAddress, socketAddress.getPortValue());\n  }\n\n  static final class EdsUpdate implements ResourceUpdate {\n    final String clusterName;\n    final Map<Locality, LocalityLbEndpoints> localityLbEndpointsMap;\n    final List<DropOverload> dropPolicies;\n\n    EdsUpdate(String clusterName, Map<Locality, LocalityLbEndpoints> localityLbEndpoints,\n              List<DropOverload> dropPolicies) {\n      this.clusterName = checkNotNull(clusterName, \"clusterName\");\n      this.localityLbEndpointsMap = Collections.unmodifiableMap(\n          new LinkedHashMap<>(checkNotNull(localityLbEndpoints, \"localityLbEndpoints\")));\n      this.dropPolicies = Collections.unmodifiableList(\n          new ArrayList<>(checkNotNull(dropPolicies, \"dropPolicies\")));\n    }\n","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/grpc/grpc-java/blob/64daddc1f3d1975670f769f3e97bde8b2ba32d25/xds/src/main/java/io/grpc/xds/XdsEndpointResource.java#L238-L274","documentation":"gRPC converts each endpoint's Envoy core.SocketAddress into a java.net.InetSocketAddress using InetAddresses.forString, which only accepts literal IP addresses (no DNS names). If the address string is not a valid IP literal, the endpoint resource is rejected with 'Address is not an IP'.","triggerScenarios":"An EDS ClusterLoadAssignment (or listener address) contains socket_address.address that is a hostname, an empty string, an IPv6 with zone id, or otherwise not parseable as an IP literal; getInetSocketAddress throws ResourceInvalidException.","commonSituations":"Control plane resolves endpoints to DNS names instead of IPs; Istio emits workload addresses in hostname form; IPv6 addresses written with brackets or scope IDs; typos in hand-written bootstrap/EDS resources.","solutions":["Make the xDS management server emit numeric IP literals in socket_address.address for endpoints","Resolve hostnames to IPs upstream (e.g. cluster DNS) before building the Endpoint resource","Verify IPv6 addresses are bare (no brackets, no %zone) e.g. '2001:db8::1'","Check for empty or whitespace-padded address strings in the EDS proto"],"exampleFix":"// before\nsocket_address { address: \"backend.default.svc.cluster.local\" port_value: 8080 }\n// after\nsocket_address { address: \"10.24.1.7\" port_value: 8080 }","handlingStrategy":"validation","validationCode":"import com.google.common.net.InetAddresses;\n// Control-plane side: ensure every endpoint address is a literal IP\nfor (var lbEndpoint : locality.getLbEndpointsList()) {\n  String addr = lbEndpoint.getEndpoint().getAddress().getSocketAddress().getAddress();\n  if (addr.isEmpty() || !InetAddresses.isInetAddress(addr)) {\n    throw new IllegalArgumentException(\"Address is not an IP: \" + addr);\n  }\n}","typeGuard":"boolean isIpLiteral(String address) {\n  return address != null && !address.isEmpty()\n      && com.google.common.net.InetAddresses.isInetAddress(address);\n}","tryCatchPattern":"// Client side: inspect watcher error containing 'Address is not an IP'\n@Override public void onError(Status error) {\n  if (error.getDescription().contains(\"Address is not an IP\")) {\n    logger.log(WARNING, \"EDS resource has non-IP endpoint address: \" + error.getDescription());\n  }\n}","preventionTips":["Have the control plane resolve hostnames to IPs before emitting Endpoint resources","Use bare IPv6 literals without brackets or zone ids","Reject non-IP endpoint addresses at resource-generation time","Verify no empty/whitespace address strings slip into serialized resources"],"tags":["grpc","xds","ip-address","eds","dns"],"backgroundTag":"invalid-argument-format","analyzedSha":"64daddc1f3d1975670f769f3e97bde8b2ba32d25","analyzedAt":"2026-09-08T06:14:57.704Z","contentChangedAt":"2026-09-08T06:14:57.704Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}