{"record":{"id":"46d83369918cdc82","repo":"apache/hadoop","slug":"target-address-cannot-be-null-configuration-prop","errorCode":null,"errorMessage":"Target address cannot be null. (configuration property '${configName}')","messagePattern":"Target address cannot be null\\. \\(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":236,"sourceCode":"   * @param useCacheIfPresent Whether use cache when create URI\n   * @return  socket addr\n   */\n  public static InetSocketAddress createSocketAddr(String target,\n                                                   int defaultPort,\n                                                   String configName,\n                                                   boolean useCacheIfPresent) {\n    return createSocketAddr(target, defaultPort, configName, useCacheIfPresent, true);\n  }\n\n  public static InetSocketAddress createSocketAddr(\n      String target, int defaultPort, String configName,\n      boolean useCacheIfPresent, boolean isResolved) {\n    String helpText = \"\";\n    if (configName != null) {\n      helpText = \" (configuration property '\" + configName + \"')\";\n    }\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      );","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/NetUtils.java#L218-L254","documentation":"IllegalArgumentException('Target address cannot be null.') from NetUtils.createSocketAddr when the target string is null. When the caller supplies a configName (e.g., 'fs.defaultFS', 'yarn.resourcemanager.scheduler.address'), the message appends '(configuration property ...)' pointing at the property whose value was null. This almost always means the configuration property was never set (or its containing *-site.xml was not loaded), not that null was passed deliberately.","triggerScenarios":"createSocketAddr(conf.get(\"fs.default.name\"), 8020, \"fs.default.name\") when the property is absent; code deriving an address from HA nameservice resolution that returned null; a service address property empty in the loaded configuration.","commonSituations":"Wrong or missing *-site.xml on the classpath so conf.get returns null; property renamed between Hadoop versions (fs.default.name vs fs.defaultFS) so the old key is unset; test or tooling code forgetting to set an address before use.","solutions":["Set the named property in the correct *-site.xml and confirm it is actually loaded (e.g., 'hadoop fs -conf' dump or conf.get in a probe)","Use the current property key for your Hadoop version (fs.defaultFS since 2.x)","Guard the call: if (target == null) fail with a clear 'property X is not set' error before calling createSocketAddr"],"exampleFix":"// before\nInetSocketAddress addr = NetUtils.createSocketAddr(conf.get(\"fs.defaultFS\"), 8020, \"fs.defaultFS\");\n// fs.defaultFS unset -> IllegalArgumentException\n\n// after\nString target = conf.get(\"fs.defaultFS\");\nif (target == null) throw new IllegalStateException(\"fs.defaultFS is not set in core-site.xml\");\nInetSocketAddress addr = NetUtils.createSocketAddr(target, 8020, \"fs.defaultFS\");","handlingStrategy":"validation","validationCode":"String target = conf.get(configName);\nif (target == null || target.trim().isEmpty()) {\n  throw new IllegalStateException(configName + \" is not set (or its site xml is not on the classpath)\");\n}","typeGuard":null,"tryCatchPattern":"catch (IllegalArgumentException e) { /* 'Target address cannot be null. (configuration property ...)' */ the message names the property: set it and retry; }","preventionTips":["Assert required address properties are non-null during service initialization","Use version-correct property keys (fs.defaultFS on 2.x+)","Add config sanity checks in unit tests for every *-site.xml you ship"],"tags":["configuration","socket-address","hadoop-common","validation"],"backgroundTag":"missing-configuration-property","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}