apache/hadoop · error · NotInMountpointException

hasPathCapability on path `<p>' is not within a mount point

Error message

hasPathCapability on path `<p>' is not within a mount point

What it means

ViewFileSystem.hasPathCapability(Path, String) first handles a few viewfs-level capabilities, then resolves the path and asks the mounted file system. If resolve() throws FileNotFoundException - the path is not under any mount point - it throws NotInMountpointException('hasPathCapability on path ... is not within a mount point'): with no backing file system, no capability can be evaluated.

Source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java:1359

  public boolean hasPathCapability(Path path, String capability)
      throws IOException {
    final Path p = makeQualified(path);
    switch (validatePathCapabilityArgs(p, capability)) {
    case CommonPathCapabilities.FS_CONCAT:
      // concat is not supported, as it may be invoked across filesystems.
      return false;
    default:
      // no break
    }
    // otherwise, check capabilities of mounted FS.
    try {
      InodeTree.ResolveResult<FileSystem> res
          = fsState.resolve(getUriPath(p), true);
      return res.targetFileSystem.hasPathCapability(res.remainingPath,
          capability);
    } catch (FileNotFoundException e) {
      // no mount point, nothing will work.
      throw new NotInMountpointException(p, "hasPathCapability");
    }
  }

  @Override
  public Path getEnclosingRoot(Path path) throws IOException {
    InodeTree.ResolveResult<FileSystem> res;
    try {
      res = fsState.resolve(getUriPath(path), true);
    } catch (FileNotFoundException ex) {
      NotInMountpointException mountPointEx =
          new NotInMountpointException(path,
              String.format("getEnclosingRoot - %s", ex.getMessage()));
      mountPointEx.initCause(ex);
      throw mountPointEx;
    }
    Path mountPath = new Path(res.resolvedPath);
    Path enclosingPath = res.targetFileSystem.getEnclosingRoot(new Path(getUriPath(path)));
    return fixRelativePart(this.makeQualified(enclosingPath.depth() > mountPath.depth()

View on GitHub (pinned to 2add963021)

Solutions

  1. Probe the capability on a concrete mounted path (the actual output/temp dir) rather than the viewfs root
  2. Add fs.viewfs.mounttable.default.linkMergeSlash=... so the root resolves and capability checks succeed
  3. Mount the directory the tool probes (e.g. the staging directory)
  4. Catch UnsupportedOperationException/NotInMountpointException and treat the capability as unsupported

Example fix

// before
boolean cap = fs.hasPathCapability(new Path("/"), "fs:path.capability.lsmt"); // throws

// after
boolean cap;
try {
  cap = fs.hasPathCapability(outDir, "fs:path.capability.lsmt");
} catch (UnsupportedOperationException e) {
  cap = false; // path not mounted -> no capability
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Probe capabilities on a concrete mounted path, never the root
Path probe = new Path("viewfs://cluster/data");
boolean cap = fs.hasPathCapability(probe, capability);

Try / catch

try {
  ok = fs.hasPathCapability(p, capability);
} catch (UnsupportedOperationException e) {
  ok = false; // p not mounted -> capability unavailable by definition
}

Prevention

When it happens

Trigger: Probing capabilities on '/' or an internal mount-table directory without linkMergeSlash; Hadoop 3.3+ code paths that check path capabilities (e.g. LSMT/streaming support, committer selection) passing the viewfs root; apps copying S3A-style capability checks onto viewfs paths.

Common situations: After a federation migration, distcp or committer code probing the output path capability on viewfs://cluster/; mount tables that only link /data and /user while the tool probes the job staging root; capability checks added in newer Hadoop releases hitting older, sparser mount tables.

Related errors


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