{"record":{"id":"f990a3334999a9dd","repo":"grpc/grpc-java","slug":"ip-address-can-not-be-found-ex","errorCode":null,"errorMessage":"IP address can not be found: \" + ex","messagePattern":"IP address can not be found: \" \\+ ex","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"xds/src/main/java/io/grpc/xds/RbacFilter.java","lineNumber":363,"sourceCode":"  private static DestinationPortRangeMatcher parseDestinationPortRangeMatcher(Int32Range range) {\n    return DestinationPortRangeMatcher.create(range.getStart(), range.getEnd());\n  }\n\n  private static DestinationIpMatcher createDestinationIpMatcher(CidrRange cidrRange) {\n    return DestinationIpMatcher.create(Matchers.CidrMatcher.create(\n            resolve(cidrRange), cidrRange.getPrefixLen().getValue()));\n  }\n\n  private static SourceIpMatcher createSourceIpMatcher(CidrRange cidrRange) {\n    return SourceIpMatcher.create(Matchers.CidrMatcher.create(\n            resolve(cidrRange), cidrRange.getPrefixLen().getValue()));\n  }\n\n  private static InetAddress resolve(CidrRange cidrRange) {\n    try {\n      return InetAddress.getByName(cidrRange.getAddressPrefix());\n    } catch (UnknownHostException ex) {\n      throw new IllegalArgumentException(\"IP address can not be found: \" + ex);\n    }\n  }\n}\n\n","sourceCodeStart":345,"sourceCodeEnd":368,"githubUrl":"https://github.com/grpc/grpc-java/blob/64daddc1f3d1975670f769f3e97bde8b2ba32d25/xds/src/main/java/io/grpc/xds/RbacFilter.java#L345-L368","documentation":"RbacFilter.resolve converts a CIDR range's address prefix into an InetAddress using InetAddress.getByName. If the host cannot be resolved (UnknownHostException), it wraps the failure in this IllegalArgumentException, meaning the RBAC config contains an IP literal or prefix that cannot be turned into an address.","triggerScenarios":"parsePermission/parsePrincipal building an IP or source-IP matcher from a CidrRange whose addressPrefix is an unresolvable hostname or malformed address string.","commonSituations":"Typo in an IP literal (e.g. '300.1.2.3'), using a DNS name in an environment without DNS, or IPv6 addresses written incorrectly in RBAC policy configs.","solutions":["Fix the address_prefix in the RBAC config to a valid IP literal (IPv4 or IPv6)","Remove any CIDR range entries with invalid or unresolvable addresses","Verify DNS resolution is available if a hostname is intentionally used"],"exampleFix":"// before\n{\"sourceIp\": {\"addressPrefix\": \"10.0.0.256\", \"prefixLen\": 32}}\n// after\n{\"sourceIp\": {\"addressPrefix\": \"10.0.0.1\", \"prefixLen\": 32}}","handlingStrategy":"validation","validationCode":"try {\n  InetAddress addr = InetAddress.getByName(cidr.getAddressPrefix());\n} catch (UnknownHostException e) {\n  throw new IllegalArgumentException(\"Invalid CIDR address prefix: \" + cidr.getAddressPrefix(), e);\n}","typeGuard":null,"tryCatchPattern":"try {\n  rbacFilter.parseFrom(proto);\n} catch (IllegalArgumentException e) {\n  logger.atWarning().withCause(e).log(\"Rejecting RBAC config: %s\", e.getMessage());\n  return Status.INVALID_ARGUMENT.withDescription(e.getMessage()).asException();\n}","preventionTips":["Use literal IPv4/IPv6 addresses (no hostnames) in CIDR ranges","Validate address prefixes with a regex or InetAddress.getByName before publishing config","Ensure DNS is functional in environments where hostnames are allowed"],"tags":["grpc","xds","rbac","dns","ip-address"],"backgroundTag":"invalid-argument-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"}