apache/hadoop · error · NotInMountpointException

getStatus on path `{}' is not within a mount point

Error message

getStatus on path `{}' is not within a mount point

What it means

Inside ViewFileSystemUtil.getStatus, after scanning all mount points the method requires the incoming path to be over a mount point, on a path leading to one, or the special case "/" (path with <=1 component). If none hold — the path neither contains nor is contained by any mount point — it throws NotInMountpointException(path, "getStatus"). This is the util-level twin of the FS-level internal-dir errors (980-984).

Source

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

        updateMountPointFsStatus(viewFileSystem, mountPointMap, mountPoint,
            new Path(viewFsUriPath));
        break;
      } else {
        if (pathCompIndex > 1) {
          // Path is in the mount tree
          isPathLeadingToMountPoint = true;
        } else if (incomingPathComponents.length <= 1) {
          // Special case of "/" path
          isPathIncludesAllMountPoint = true;
        }
        updateMountPointFsStatus(viewFileSystem, mountPointMap, mountPoint,
            mountPoint.getMountedOnPath());
      }
    }

    if (!isPathOverMountPoint && !isPathLeadingToMountPoint &&
        !isPathIncludesAllMountPoint) {
      throw new NotInMountpointException(path, "getStatus");
    }
    return mountPointMap;
  }

  /**
   * Update FsStatus for the given the mount point.
   *
   * @param viewFileSystem
   * @param mountPointMap
   * @param mountPoint
   * @param path
   */
  private static void updateMountPointFsStatus(
      final ViewFileSystem viewFileSystem,
      final Map<MountPoint, FsStatus> mountPointMap,
      final MountPoint mountPoint, final Path path) throws IOException {
    FsStatus fsStatus = viewFileSystem.getStatus(path);
    mountPointMap.put(mountPoint, fsStatus);

View on GitHub (pinned to 2add963021)

Solutions

  1. Query "/" (or any mount point root) to get status for all mount points at once
  2. Pass a path that is or contains at least one mount point
  3. Add a mount-table link for the queried prefix if it should be backed by a cluster
  4. Catch NotInMountpointException and report the valid mount points to the caller

Example fix

// before
Map<MountPoint, FsStatus> m = ViewFileSystemUtil.getStatus(vfs, new Path("/tmp"));

// after
Path q = new Path("/"); // aggregate over every mount point
Map<MountPoint, FsStatus> m = ViewFileSystemUtil.getStatus(vfs, q);
Defensive patterns

Strategy: validation

Validate before calling

static boolean statusQueryPathOk(ViewFileSystem vfs, Path p) {
  if (p.toUri().getPath().equals("/")) return true; // includes all mount points
  String s = p.toUri().getPath();
  for (MountPoint mp : vfs.getMountPoints()) {
    String m = mp.getMountedOnPath().toUri().getPath();
    boolean over = s.equals(m) || s.startsWith(m + "/");
    boolean leading = m.equals(s) || m.startsWith(s.endsWith("/") ? s : s + "/");
    if (over || leading) return true;
  }
  return false;
}

Try / catch

try {
  map = ViewFileSystemUtil.getStatus(vfs, p);
} catch (NotInMountpointException e) {
  map = ViewFileSystemUtil.getStatus(vfs, new Path("/")); // widen to all mount points
}

Prevention

When it happens

Trigger: ViewFileSystemUtil.getStatus(vfs, new Path("/tmp")) when no mount point equals /tmp or lives under it and the path is not "/"; querying an arbitrary directory on a mount table that mounts only /user and /data.

Common situations: Capacity widgets fed a user-supplied path argument; scripts reused from plain-HDFS deployments passing scratch dirs (/tmp, /var) that the federation mount table intentionally does not cover.

Related errors


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