{"record":{"id":"2d0760ec078c8ee6","repo":"apache/druid","slug":"failed-to-parse-address-2d0760","errorCode":null,"errorMessage":"failed to parse address","messagePattern":"failed to parse address","errorType":"validation","errorClass":"DruidException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/query/expression/IPv6AddressMatchExprMacro.java","lineNumber":108,"sourceCode":"\n        private boolean isStringMatch(String stringValue)\n        {\n          IPAddressString addressString = IPv6AddressExprUtils.parseString(stringValue);\n          return addressString != null && blockString.prefixContains(addressString);\n        }\n\n        @Nullable\n        @Override\n        public ExpressionType getOutputType(InputBindingInspector inspector)\n        {\n          return ExpressionType.LONG;\n        }\n      }\n\n      return new IPv6AddressMatchExpr(args);\n    }\n    catch (Exception e) {\n      throw processingFailed(e, \"failed to parse address\");\n    }\n  }\n\n  private IPAddressString getSubnetInfo(List<Expr> args)\n  {\n    String subnetArgName = \"subnet\";\n    Expr arg = args.get(ARG_SUBNET);\n    validationHelperCheckArgIsLiteral(arg, subnetArgName);\n    String subnet = (String) arg.getLiteralValue();\n    if (!IPv6AddressExprUtils.isValidIPv6Subnet(subnet)) {\n      throw validationFailed(subnetArgName + \" arg has an invalid format: \" + subnet);\n    }\n    return new IPAddressString(subnet);\n  }\n}\n","sourceCodeStart":90,"sourceCodeEnd":124,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/query/expression/IPv6AddressMatchExprMacro.java#L90-L124","documentation":"The IPV6_MATCH expression macro parses its arguments with IPAddressString at macro-apply time; any exception during that parse is rethrown as a processing failure with message 'failed to parse address'. This guards against addresses that the underlying library cannot even interpret (not merely addresses that fail the match).","triggerScenarios":"Invoking IPV6_MATCH with an address or subnet expression whose value triggers a parse exception inside IPAddressString, e.g. malformed IPv6 text with invalid groups, double colons in wrong positions, or an address embedded with a scope/zone id in an unsupported form.","commonSituations":"Ingesting IPv6 data with junk values (':::', 'fe80::1%eth0' variants) and running IPV6_MATCH over the column; hand-written expressions where the address literal was mis-escaped; mixed IPv4-in-IPv6 strings that the library rejects.","solutions":["Validate the column or literal with IPv6AddressExprUtils.isValidIPv6(value) before using IPV6_MATCH.","Clean the data upstream: strip zone IDs/ports and normalize to canonical IPv6 notation.","If a literal, verify correct bracketing/escaping of the IPv6 string in your query JSON or SQL."],"exampleFix":"-- before\nSELECT IPV6_MATCH(ip, 'fe80::1%eth0/64') FROM t\n-- after\nSELECT IPV6_MATCH(ip, 'fe80::/64') FROM t","handlingStrategy":"validation","validationCode":"// Java\nif (!IPv6AddressExprUtils.isValidIPv6(candidate)) { throw new IllegalArgumentException(\"not a valid IPv6 address: \" + candidate); }","typeGuard":"static boolean looksLikeIPv6(String s) {\n  return s != null && s.contains(\":\") && !s.contains(\"%\");\n}","tryCatchPattern":"try {\n  return evalExpression(expr);\n} catch (ExpressionProcessingException e) {\n  if (e.getMessage().contains(\"failed to parse address\")) {\n    log.warn(\"Skipping unparseable IPv6 value\");\n    return null;\n  }\n  throw e;\n}","preventionTips":["Normalize IPv6 data at ingestion (canonical form, no zone IDs).","Validate IPv6 literals before embedding them in expressions.","Segment data quality checks so bad rows are quarantined, not queried."],"tags":["druid","expression","ipv6","parse-error"],"backgroundTag":"invalid-argument-format","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}