{"record":{"id":"855b1b771b2452c2","repo":"grpc/grpc-java","slug":"failed-to-parse-envoy-config-core-v3-address-inva","errorCode":null,"errorMessage":"Failed to parse envoy.config.core.v3.Address: Invalid IP address or port: <ip>:<port>","messagePattern":"Failed to parse envoy\\.config\\.core\\.v3\\.Address: Invalid IP address or port: <ip>:<port>","errorType":"validation","errorClass":"ResourceInvalidException","httpStatus":null,"severity":"error","filePath":"xds/src/main/java/io/grpc/xds/XdsEndpointResource.java","lineNumber":329,"sourceCode":"    }\n\n    @Override\n    public java.net.SocketAddress parse(Any any) throws ResourceInvalidException {\n      SocketAddress socketAddress;\n      try {\n        socketAddress = any.unpack(Address.class).getSocketAddress();\n      } catch (InvalidProtocolBufferException ex) {\n        throw new ResourceInvalidException(\"Invalid Resource in address proto\", ex);\n      }\n      validateAddress(socketAddress);\n\n      String ip = socketAddress.getAddress();\n      int port = socketAddress.getPortValue();\n\n      try {\n        return new InetSocketAddress(InetAddresses.forString(ip), port);\n      } catch (IllegalArgumentException e) {\n        throw createException(\"Invalid IP address or port: \" + ip + \":\" + port);\n      }\n    }\n\n    private void validateAddress(SocketAddress socketAddress) throws ResourceInvalidException {\n      if (socketAddress.getAddress().isEmpty()) {\n        throw createException(\"Address field is empty or invalid.\");\n      }\n      long port = Integer.toUnsignedLong(socketAddress.getPortValue());\n      if (port > 65535) {\n        throw createException(String.format(\"Port value %d out of range 1-65535.\", port));\n      }\n    }\n\n    private ResourceInvalidException createException(String message) {\n      return new ResourceInvalidException(\n          \"Failed to parse envoy.config.core.v3.Address: \" + message);\n    }\n  }","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/grpc/grpc-java/blob/64daddc1f3d1975670f769f3e97bde8b2ba32d25/xds/src/main/java/io/grpc/xds/XdsEndpointResource.java#L311-L347","documentation":"XdsEndpointResource parses envoy.config.core.v3.Address protos from xDS (LDS/RDS/EDS) responses into java.net.InetSocketAddress. If InetAddresses.forString(ip) fails because the address string is not a valid IPv4/IPv6 literal, the parser wraps the failure in a ResourceInvalidException carrying the 'Invalid IP address or port' message. The xDS resource is then rejected as invalid (NACKed).","triggerScenarios":"An xDS management server sends an endpoint/cluster address whose socketAddress.address string is not a parseable IP literal (e.g. a hostname, empty-ish junk, or malformed IPv6) to XdsEndpointResource.parse; InetAddresses.forString throws IllegalArgumentException.","commonSituations":"Envoy/control-plane config using DNS names in Address.address (envoy allows hostnames via DNS resolvers, but gRPC xDS expects IP literals); typos or regional placeholders like '<ip>:<port>' from templated config; IPv6 strings with zone IDs or bad formatting.","solutions":["Fix the xDS management server config so Address.address contains a valid IPv4/IPv6 literal (e.g. 10.0.0.5 or fd00::1) instead of a hostname or placeholder.","If DNS names are required, resolve them to IPs on the control plane or use a resource that supports DNS endpoints per your gRPC xDS version.","Check the raw xDS resource dump (xDS node logs) to see the exact offending address string and correct it.","Verify IPv6 formatting (no zone IDs like %eth0, properly compressed) if using IPv6."],"exampleFix":"# before (xDS/EADS endpoint config)\naddress: { socket_address: { address: \"my-service.internal\", port_value: 50051 } }\n\n# after\naddress: { socket_address: { address: \"10.24.3.7\", port_value: 50051 } }","handlingStrategy":"validation","validationCode":"// before pushing endpoint config to the management server\nif (!InetAddresses.isInetAddress(addr.address())) {\n  throw new IllegalArgumentException(\"Endpoint address must be an IP literal, got: \" + addr.address());\n}","typeGuard":"static boolean isValidIpLiteral(String s) {\n  return s != null && !s.isEmpty() && InetAddresses.isInetAddress(s);\n}","tryCatchPattern":"try {\n  endpoint = xdsClient.watchEndpoint(...);\n} catch (ResourceInvalidException e) {\n  logger.error(\"xDS endpoint resource invalid (address parse): \" + e.getMessage());\n  alertControlPlaneOperator(resourceName);\n}","preventionTips":["Use only IP literals (no hostnames) in xDS SocketAddress.address.","Lint control-plane configs with a schema check that validates IP format and port range before publishing.","Watch for gRPC xDS NACK logs to catch malformed resources early.","If DNS endpoints are needed, resolve them on the control plane or use a gRPC version supporting DNS in xDS endpoints."],"tags":["grpc","xds","envoy","address-parsing","ipv4","ipv6"],"backgroundTag":"invalid-config-value","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"}