apache/hadoop · error · IllegalArgumentException

Wrong name service specified : {}

Error message

Wrong name service specified : {}

What it means

FederationUtil.getNameservices() parses each value of dfs.federation.router.monitor.namenode into a nameservice id: 'nsId.nnId' (two components) or a bare 'nsId' (one component) are accepted; any value whose split on '.' produces more than two parts throws IllegalArgumentException('Wrong name service specified'). It rejects config entries (e.g., host-qualified strings) that cannot map to a nameservice, failing router startup/monitoring initialization.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/FederationUtil.java:297

   * @throws IllegalArgumentException if monitored namenodes are not correctly configured.
   */
  public static Set<String> getAllConfiguredNS(Configuration conf)
      throws IllegalArgumentException {
    // Get all name services configured
    Collection<String> namenodes = conf.getTrimmedStringCollection(
        DFS_ROUTER_MONITOR_NAMENODE);

    Set<String> nameservices = new HashSet();
    for (String namenode : namenodes) {
      String[] namenodeSplit = namenode.split("\\.");
      String nsId;
      if (namenodeSplit.length == 2) {
        nsId = namenodeSplit[0];
      } else if (namenodeSplit.length == 1) {
        nsId = namenode;
      } else {
        String errorMsg = "Wrong name service specified : " + namenode;
        throw new IllegalArgumentException(
            errorMsg);
      }
      nameservices.add(nsId);
    }
    return nameservices;
  }
}

View on GitHub (pinned to 2add963021)

Solutions

  1. Edit dfs.federation.router.monitor.namenode to use only nsId or nsId.nnId forms (e.g., ns0.nn1)
  2. If you meant to monitor router-adjacent namenodes by role, use the appropriate keys (e.g., dfs.federation.router.monitor.localnamenode) instead of host names here
  3. Restart/reload the router after fixing the configuration

Example fix

<!-- before -->
<property>
  <name>dfs.federation.router.monitor.namenode</name>
  <value>ns0.nn1.ns0.example.com</value>
</property>
<!-- after -->
<property>
  <name>dfs.federation.router.monitor.namenode</name>
  <value>ns0.nn1</value>
</property>
Defensive patterns

Strategy: validation

Validate before calling

// Validate monitor entries before starting the router
for (String nn : conf.getTrimmedStrings("dfs.federation.router.monitor.namenode")) {
  if (nn.split("\\.").length > 2) {
    throw new IllegalArgumentException(
        "Bad dfs.federation.router.monitor.namenode entry (want nsId or nsId.nnId): " + nn);
  }
}

Prevention

When it happens

Trigger: dfs.federation.router.monitor.namenode contains a value like ns0.nn1.ns0.example.com or any dotted entry with 3+ components — commonly an FQDN or rpc-address pasted instead of the nsId[.nnId] identifier.

Common situations: Operators copy values from dfs.namenode.rpc-address.* (host:port or FQDN forms) into the monitor key; typo'd multi-dot identifiers during initial router setup.

Related errors


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