{"record":{"id":"2be724ae38368c57","repo":"apache/hadoop","slug":"does-not-contain-a-valid-host-port-authority-ta","errorCode":null,"errorMessage":"Does not contain a valid host:port authority: ${target} (configuration property '${configName}')","messagePattern":"Does not contain a valid host:port authority: (.+?) \\(configuration property '(.+?)'\\)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java","lineNumber":252,"sourceCode":"    }\n    if (target == null) {\n      throw new IllegalArgumentException(\"Target address cannot be null.\" +\n          helpText);\n    }\n    target = target.trim();\n    boolean hasScheme = target.contains(\"://\");\n    URI uri = createURI(target, hasScheme, helpText, useCacheIfPresent);\n\n    String host = uri.getHost();\n    int port = uri.getPort();\n    if (port == -1) {\n      port = defaultPort;\n    }\n    String path = uri.getPath();\n\n    if ((host == null) || (port < 0) ||\n        (!hasScheme && path != null && !path.isEmpty())) {\n      throw new IllegalArgumentException(\n          \"Does not contain a valid host:port authority: \" + target + helpText\n      );\n    }\n    if (isResolved) {\n      return createSocketAddrForHost(host, port);\n    }\n    return InetSocketAddress.createUnresolved(host, port);\n  }\n\n  private static final long URI_CACHE_SIZE_DEFAULT = 1000;\n  private static final long URI_CACHE_EXPIRE_TIME_DEFAULT = 12;\n  private static final Cache<String, URI> URI_CACHE = CacheBuilder.newBuilder()\n      .maximumSize(URI_CACHE_SIZE_DEFAULT)\n      .expireAfterWrite(URI_CACHE_EXPIRE_TIME_DEFAULT, TimeUnit.HOURS)\n      .build();\n\n  private static URI createURI(String target,\n                               boolean hasScheme,","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java#L234-L270","documentation":"IllegalArgumentException from NetUtils.createSocketAddr when the target parsed into a URI but does not describe a pure host:port authority: host is null, port is negative, or (when no 'scheme://' was present) the string carries a non-empty path component. The message echoes the offending target and the configuration property name when provided. This is the standard 'bad service address' error for properties like fs.defaultFS or YARN RM addresses.","triggerScenarios":"Values like 'hdfs://:9000' (empty host), 'host:port/path' without a scheme (path is rejected), 'hdfs://host:port/junk' is fine only because hasScheme is true — but a port of '-1' after parsing with no default, or targets such as 'localhost:notaport', produce invalid components that fail here or in createURI.","commonSituations":"Missing port where the caller passes defaultPort=-1; stray slashes or whitespace after trimming; IPv6 addresses written unbracketed so the URI host comes back null; copied config with 'hdfs://host:9000/extra/path' where the path makes no sense for a service address... path only matters without scheme, so typical hits are scheme-less 'host:port/path' or empty-host forms.","solutions":["Write the address as 'host:port' or 'scheme://host:port' exactly, no path, no trailing slash","Bracket IPv6 literals: 'hdfs://[2001:db8::1]:9000'","Check the property named in the message for accidental characters (trailing '/', spaces, smart quotes from copy-paste)","Ensure a port is present or a valid defaultPort is passed by the calling API"],"exampleFix":"<!-- before -->\n<property><name>fs.defaultFS</name><value>myhost:8020/typo</value></property> <!-- path without scheme -> IllegalArgumentException -->\n\n<!-- after -->\n<property><name>fs.defaultFS</name><value>hdfs://myhost:8020</value></property>","handlingStrategy":"validation","validationCode":"URI u = URI.create(target.contains(\"://\") ? target : \"dummyscheme://\" + target);\nif (u.getHost() == null || u.getPort() < -1 || (!target.contains(\"://\") && u.getPath() != null && !u.getPath().isEmpty())) {\n  throw new IllegalStateException(\"bad address: \" + target);\n}","typeGuard":null,"tryCatchPattern":"catch (IllegalArgumentException e) { /* 'Does not contain a valid host:port authority' */ the message includes the raw value and property: fix format and reload config; }","preventionTips":["Standardize service addresses as scheme://host:port or host:port with no path","Bracket IPv6 literals: hdfs://[::1]:9000","Add a createSocketAddr smoke check for all service addresses at startup"],"tags":["configuration","socket-address","uri-parsing","hadoop-common","validation"],"backgroundTag":"invalid-host-port-authority","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}