{"record":{"id":"26c2d6d919b229f3","repo":"grpc/grpc-java","slug":"invalid-address-empty-address-is-not-allowed","errorCode":null,"errorMessage":"Invalid address: Empty address is not allowed.","messagePattern":"Invalid address: Empty address is not allowed\\.","errorType":"validation","errorClass":"ResourceInvalidException","httpStatus":null,"severity":"error","filePath":"xds/src/main/java/io/grpc/xds/XdsListenerResource.java","lineNumber":170,"sourceCode":"      throw new ResourceInvalidException(\n          \"Listener \" + proto.getName() + \" with invalid traffic direction: \" + trafficDirection);\n    }\n    if (!proto.getListenerFiltersList().isEmpty()) {\n      throw new ResourceInvalidException(\n          \"Listener \" + proto.getName() + \" cannot have listener_filters\");\n    }\n    if (proto.hasUseOriginalDst()) {\n      throw new ResourceInvalidException(\n          \"Listener \" + proto.getName() + \" cannot have use_original_dst set to true\");\n    }\n\n    String address = null;\n    SocketAddress socketAddress = null;\n    if (proto.getAddress().hasSocketAddress()) {\n      socketAddress = proto.getAddress().getSocketAddress();\n      address = socketAddress.getAddress();\n      if (address.isEmpty()) {\n        throw new ResourceInvalidException(\"Invalid address: Empty address is not allowed.\");\n      }\n      switch (socketAddress.getPortSpecifierCase()) {\n        case NAMED_PORT:\n          throw new ResourceInvalidException(\"NAMED_PORT is not supported in gRPC.\");\n        case PORT_VALUE:\n          address = address + \":\" + socketAddress.getPortValue();\n          break;\n        default:\n          // noop\n      }\n    }\n\n    ImmutableList.Builder<FilterChain> filterChains = ImmutableList.builder();\n    Set<String> filterChainNames = new HashSet<>();\n    Set<FilterChainMatch> filterChainMatchSet = new HashSet<>();\n    int i = 0;\n    for (io.envoyproxy.envoy.config.listener.v3.FilterChain fc : proto.getFilterChainsList()) {\n      // May be empty. If it's not empty, required to be unique.","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/grpc/grpc-java/blob/64daddc1f3d1975670f769f3e97bde8b2ba32d25/xds/src/main/java/io/grpc/xds/XdsListenerResource.java#L152-L188","documentation":"A server-side Listener must carry a concrete socket address so gRPC knows which port the filters apply to. If address.socket_address.address is present but empty, the Listener is rejected with 'Invalid address: Empty address is not allowed.'","triggerScenarios":"A Listener proto has address.socket_address set but its address field is an empty string; parseServerSideListener throws before evaluating port specifiers. (Note: named_port is also rejected separately.)","commonSituations":"Management server generating listener templates without filling the bind address; hand-written LDS resources with address omitted inside socket_address; configs relying on Envoy's default/empty bind behavior that gRPC does not allow.","solutions":["Set an explicit IP literal (e.g. 0.0.0.0 or the pod IP) in address.socket_address.address on the management server","Fix listener-generation logic so every server-side Listener gets a concrete bind address","Check whether named_port was intended — gRPC requires port_value and a non-empty address","Re-push the corrected Listener so the update is ACKed"],"exampleFix":"// before\naddress { socket_address { protocol: TCP port_value: 9090 } }\n// after\naddress { socket_address { protocol: TCP address: \"0.0.0.0\" port_value: 9090 } }","handlingStrategy":"validation","validationCode":"// Control-plane side: require a non-empty address and port_value\nif (listener.getAddress().hasSocketAddress()) {\n  String addr = listener.getAddress().getSocketAddress().getAddress();\n  if (addr.isEmpty()) {\n    throw new IllegalArgumentException(\"Invalid address: Empty address is not allowed.\");\n  }\n}","typeGuard":"boolean hasConcreteSocketAddress(io.envoyproxy.envoy.config.listener.v3.Listener listener) {\n  return listener.getAddress().hasSocketAddress()\n      && !listener.getAddress().getSocketAddress().getAddress().isEmpty();\n}","tryCatchPattern":"// Client side: detect empty listener addresses from watcher errors\n@Override public void onError(Status error) {\n  if (error.getDescription().contains(\"Empty address is not allowed\")) {\n    logger.log(WARNING, \"Listener has empty socket address: \" + error.getDescription());\n  }\n}","preventionTips":["Always populate address.socket_address.address with a concrete IP on server listeners","Use port_value, never named_port, for gRPC server listeners","Fill listener templates before serialization; fail generation on empty address fields","Validate generated LDS resources against gRPC's supported subset before push"],"tags":["grpc","xds","lds","socket-address","validation"],"backgroundTag":"empty-required-field","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"}