apache/hadoop · error · RuntimeException

Could not find any configured addresses for URI {}

Error message

Could not find any configured addresses for URI {}

What it means

HA proxy providers (ConfiguredFailoverProxyProvider and subclasses) resolve NameNode addresses for the logical URI's nameservice via DFSUtilClient.getAddresses over keys such as dfs.ha.namenodes.<ns>.rpc-address. When the returned map has no entry for the URI host, the client has no HA address config for that nameservice and getProxyAddresses throws RuntimeException during proxy provider construction - before any RPC.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/server/namenode/ha/AbstractNNFailoverProxyProvider.java:203

            this.getClass().getSimpleName(), pi.address, ioe);
        throw new RuntimeException(ioe);
      }
    }
    return pi;
  }

  /**
   * Get list of configured NameNode proxy addresses.
   * Randomize the list if requested.
   */
  protected List<NNProxyInfo<T>> getProxyAddresses(URI uri, String addressKey) {
    final List<NNProxyInfo<T>> proxies = new ArrayList<NNProxyInfo<T>>();
    Map<String, Map<String, InetSocketAddress>> map =
        DFSUtilClient.getAddresses(conf, null, addressKey);
    Map<String, InetSocketAddress> addressesInNN = map.get(uri.getHost());

    if (addressesInNN == null || addressesInNN.size() == 0) {
      throw new RuntimeException("Could not find any configured addresses " +
          "for URI " + uri);
    }

    Collection<InetSocketAddress> addressesOfNns = addressesInNN.values();
    try {
      addressesOfNns = getResolvedHostsIfNecessary(addressesOfNns, uri);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    for (InetSocketAddress address : addressesOfNns) {
      proxies.add(new NNProxyInfo<T>(address));
    }
    // Randomize the list to prevent all clients pointing to the same one
    boolean randomized = getRandomOrder(conf, uri);
    if (randomized) {
      Collections.shuffle(proxies);
    }

View on GitHub (pinned to 2add963021)

Solutions

  1. Add the full HA block: dfs.nameservices=<ns>, dfs.ha.namenodes.<ns>=nn1,nn2, dfs.ha.namenodes.<ns>.nn1=<host:port>, dfs.ha.namenodes.<ns>.nn2=<host:port>, dfs.client.failover.proxy.provider.<ns>=org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider
  2. Verify the URI authority matches the configured nameservice id exactly
  3. Point HADOOP_CONF_DIR (or the Configuration resources) at the cluster's real config directory

Example fix

<!-- before: only nameservice referenced, no HA entries -->

<!-- after: add to core-site.xml -->
<property>
  <name>dfs.nameservices</name>
  <value>ns1</value>
</property>
<property>
  <name>dfs.ha.namenodes.ns1</name>
  <value>nn1,nn2</value>
</property>
<property>
  <name>dfs.ha.namenodes.ns1.nn1</name>
  <value>nn1.example.com:8020</value>
</property>
<property>
  <name>dfs.ha.namenodes.ns1.nn2</name>
  <value>nn2.example.com:8020</value>
</property>
<property>
  <name>dfs.client.failover.proxy.provider.ns1</name>
  <value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value>
</property>
Defensive patterns

Strategy: validation

Validate before calling

String ns = uri.getHost();
if (conf.get("dfs.ha.namenodes." + ns) == null) {
  throw new IllegalArgumentException(
      "No HA configuration for nameservice '" + ns
      + "' - check dfs.nameservices and dfs.ha.namenodes." + ns + " entries");
}
FileSystem fs = FileSystem.get(uri, conf);

Try / catch

catch (RuntimeException e) with message containing "Could not find any configured addresses": fail startup with a config checklist instead of retrying.

Prevention

When it happens

Trigger: FileSystem.get on hdfs://ns1/... where dfs.nameservices / dfs.ha.namenodes.ns1.<nn> address keys are absent from the client Configuration; or the URI authority is a nameservice id that is misspelled relative to the configured one.

Common situations: Client core-site.xml missing the HA block; HADOOP_CONF_DIR pointing at the wrong config directory; using a logical URI while only physical dfs.namenode.rpc-address entries exist; nameservice typos (ns1 vs prod-ns).

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/f0ac6e13e264842c. Report an issue: GitHub.