apache/hadoop · error · NotInMountpointException

getServerDefaults on path `<f>' is not within a mount point

Error message

getServerDefaults on path `<f>' is not within a mount point

What it means

ViewFileSystem.getServerDefaults(Path) resolves the path through the mount table and forwards to the target file system's getServerDefaults(). If resolve() throws FileNotFoundException - no mount point covers the path - it is rethrown as NotInMountpointException('getServerDefaults on path ... is not within a mount point'). Server defaults are per-cluster values, so an unmounted path has none.

Source

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

      InodeTree.ResolveResult<FileSystem> res =
        fsState.resolve(getUriPath(f), true);
      return res.targetFileSystem.getDefaultReplication(res.remainingPath);
    } catch (FileNotFoundException e) {
      throw new NotInMountpointException(f, "getDefaultReplication");
    } catch (IOException e) {
      throw new RuntimeException("Not able to initialize fs in "
          + " getDefaultReplication for path " + f + " with exception", e);
    }
  }

  @Override
  public FsServerDefaults getServerDefaults(Path f) throws IOException {
    try {
      InodeTree.ResolveResult<FileSystem> res =
          fsState.resolve(getUriPath(f), true);
      return res.targetFileSystem.getServerDefaults(res.remainingPath);
    } catch (FileNotFoundException e) {
      throw new NotInMountpointException(f, "getServerDefaults");
    }
  }

  @Override
  public ContentSummary getContentSummary(Path f) throws IOException {
    InodeTree.ResolveResult<FileSystem> res =
      fsState.resolve(getUriPath(f), true);
    return res.targetFileSystem.getContentSummary(res.remainingPath);
  }

  @Override
  public QuotaUsage getQuotaUsage(Path f) throws IOException {
    InodeTree.ResolveResult<FileSystem> res =
        fsState.resolve(getUriPath(f), true);
    return res.targetFileSystem.getQuotaUsage(res.remainingPath);
  }

  @Override

View on GitHub (pinned to 2add963021)

Solutions

  1. Call getServerDefaults on a concrete mounted path (e.g. the job output directory once it is mounted)
  2. Mount the missing directory: fs.viewfs.mounttable.default.link.<name>=<target>
  3. Configure fs.viewfs.mounttable.default.linkMergeSlash=... so the root itself resolves and getServerDefaults('/') works
  4. Catch NotInMountpointException and fall back to defaults obtained from the target HDFS handle

Example fix

// before
FsServerDefaults d = fs.getServerDefaults(new Path("/")); // throws without linkMergeSlash

// after
FsServerDefaults d;
try {
  d = fs.getServerDefaults(outPath);
} catch (NotInMountpointException e) {
  d = fs.getServerDefaults(new Path("viewfs://cluster/data")); // known mount
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Use a mounted probe path for server defaults
Path probe = new Path("viewfs://cluster/data"); // a known mount
if (!fs.exists(probe)) throw new IllegalStateException("probe mount missing");
FsServerDefaults d = fs.getServerDefaults(probe);

Try / catch

try {
  FsServerDefaults d = fs.getServerDefaults(p);
} catch (NotInMountpointException e) {
  FsServerDefaults d = FileSystem.get(targetUri, conf).getServerDefaults(); // ask target HDFS
}

Prevention

When it happens

Trigger: Calling getServerDefaults(new Path("/")) or getServerDefaults on a mount-table internal directory when no linkMergeSlash is configured; calling it on a path whose prefix matches no fs.viewfs.mounttable.default.link.* entry (e.g. writers querying defaults for a staging dir that was never mounted).

Common situations: Output committers (e.g. FileOutputCommitter, distcp -pb) that fetch server defaults for the output directory; viewfs cutovers where the output/staging directories were left out of the mount table; tools hard-coding '/' as the probe path.

Related errors


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