apache/hadoop · error · RouterResolveException

Cannot find locations for {}, because the default nameservic

Error message

Cannot find locations for {}, because the default nameservice is disabled to read or write

What it means

MountTableResolver.lookupLocation() resolves a path to its remote location by finding the deepest matching mount entry. If no entry matches, the fallback is to route the path to the default nameservice — but when that fallback is disabled (dfs.federation.router.default.nameservice.enable=false, key dfs.federation.router.default.nameserviceId for the id) it throws RouterResolveException: in strict mode only explicitly mounted paths are routable.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/resolver/MountTableResolver.java:502

  }

  /**
   * Build the path location to insert into the cache atomically. It must hold
   * the read lock.
   * @param str Path to check/insert.
   * @return New remote location.
   * @throws IOException If it cannot find the location.
   */
  public PathLocation lookupLocation(final String str) throws IOException {
    PathLocation ret = null;
    final String path = RouterAdmin.normalizeFileSystemPath(str);
    MountTable entry = findDeepest(path);
    if (entry != null) {
      ret = buildLocation(path, entry);
    } else {
      // Not found, use default location
      if (!defaultNSEnable) {
        throw new RouterResolveException("Cannot find locations for " + path
            + ", because the default nameservice is disabled to read or write");
      }
      RemoteLocation remoteLocation =
          new RemoteLocation(defaultNameService, path, path);
      List<RemoteLocation> locations =
          Collections.singletonList(remoteLocation);
      ret = new PathLocation(null, locations);
    }
    return ret;
  }

  /**
   * Get the mount table entry for a path.
   *
   * @param path Path to look for.
   * @return Mount table entry the path belongs.
   * @throws IOException If the State Store could not be reached.
   */

View on GitHub (pinned to 2add963021)

Solutions

  1. Add a mount covering the path: hdfs dfsrouteradmin -add /user -ns ns0 -dst /user, then refresh the router caches
  2. Or re-enable the fallback: set dfs.federation.router.default.nameservice.enable=true and dfs.federation.router.default.nameserviceId=<healthy nsId>, restart the router
  3. Audit client paths against hdfs dfsrouteradmin -list and align them with mounted trees

Example fix

<!-- before: strict mode, no mount for /user -->
<property>
  <name>dfs.federation.router.default.nameservice.enable</name>
  <value>false</value>
</property>
<!-- after: enable default-nameservice fallback -->
<property>
  <name>dfs.federation.router.default.nameservice.enable</name>
  <value>true</value>
</property>
<property>
  <name>dfs.federation.router.default.nameserviceId</name>
  <value>ns0</value>
</property>
Defensive patterns

Strategy: fallback

Validate before calling

// Client-side: verify the path falls under a mount before sending traffic
Collection<MountTable> mounts = routerClient.getMountTableManager()
    .getMountTableEntries(null).getEntries();
boolean covered = mounts.stream()
    .anyMatch(m -> normalizedPath.startsWith(m.getSourcePath()));
if (!covered && !defaultNsFallbackEnabled) {
  // route directly to a concrete cluster instead of the router
  target = new Path("hdfs://ns0" + normalizedPath);
}

Try / catch

try {
  PathLocation loc = resolver.lookupLocation(path);
} catch (RouterResolveException e) {
  // not mounted and default NS disabled → send the op straight to a concrete cluster
  return new Path("hdfs://ns0" + path);
}

Prevention

When it happens

Trigger: A client sends a filesystem RPC through the router for a path not under any mount table entry (e.g., /user/me with no /user mount, /tmp with no mount) while the router runs with the default-nameservice fallback disabled.

Common situations: RBF deployments that disable default-NS fallback to enforce mount hygiene; new path trees used by clients before an admin adds the mount; applications with hardcoded absolute paths outside the mounted tree.

Related errors


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