{"record":{"id":"cfde9b07c84bb568","repo":"apache/hadoop","slug":"haspathcapability-on-path-p-is-not-within-a-mo","errorCode":null,"errorMessage":"hasPathCapability on path `<p>' is not within a mount point","messagePattern":"hasPathCapability on path `<p>' is not within a mount point","errorType":"exception","errorClass":"NotInMountpointException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java","lineNumber":1359,"sourceCode":"  public boolean hasPathCapability(Path path, String capability)\n      throws IOException {\n    final Path p = makeQualified(path);\n    switch (validatePathCapabilityArgs(p, capability)) {\n    case CommonPathCapabilities.FS_CONCAT:\n      // concat is not supported, as it may be invoked across filesystems.\n      return false;\n    default:\n      // no break\n    }\n    // otherwise, check capabilities of mounted FS.\n    try {\n      InodeTree.ResolveResult<FileSystem> res\n          = fsState.resolve(getUriPath(p), true);\n      return res.targetFileSystem.hasPathCapability(res.remainingPath,\n          capability);\n    } catch (FileNotFoundException e) {\n      // no mount point, nothing will work.\n      throw new NotInMountpointException(p, \"hasPathCapability\");\n    }\n  }\n\n  @Override\n  public Path getEnclosingRoot(Path path) throws IOException {\n    InodeTree.ResolveResult<FileSystem> res;\n    try {\n      res = fsState.resolve(getUriPath(path), true);\n    } catch (FileNotFoundException ex) {\n      NotInMountpointException mountPointEx =\n          new NotInMountpointException(path,\n              String.format(\"getEnclosingRoot - %s\", ex.getMessage()));\n      mountPointEx.initCause(ex);\n      throw mountPointEx;\n    }\n    Path mountPath = new Path(res.resolvedPath);\n    Path enclosingPath = res.targetFileSystem.getEnclosingRoot(new Path(getUriPath(path)));\n    return fixRelativePart(this.makeQualified(enclosingPath.depth() > mountPath.depth()","sourceCodeStart":1341,"sourceCodeEnd":1377,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java#L1341-L1377","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Probe the capability on a concrete mounted path (the actual output/temp dir) rather than the viewfs root","Add fs.viewfs.mounttable.default.linkMergeSlash=... so the root resolves and capability checks succeed","Mount the directory the tool probes (e.g. the staging directory)","Catch UnsupportedOperationException/NotInMountpointException and treat the capability as unsupported"],"exampleFix":"// before\nboolean cap = fs.hasPathCapability(new Path(\"/\"), \"fs:path.capability.lsmt\"); // throws\n\n// after\nboolean cap;\ntry {\n  cap = fs.hasPathCapability(outDir, \"fs:path.capability.lsmt\");\n} catch (UnsupportedOperationException e) {\n  cap = false; // path not mounted -> no capability\n}","handlingStrategy":"try-catch","validationCode":"// Probe capabilities on a concrete mounted path, never the root\nPath probe = new Path(\"viewfs://cluster/data\");\nboolean cap = fs.hasPathCapability(probe, capability);","typeGuard":null,"tryCatchPattern":"try {\n  ok = fs.hasPathCapability(p, capability);\n} catch (UnsupportedOperationException e) {\n  ok = false; // p not mounted -> capability unavailable by definition\n}","preventionTips":["Pass the actual output/temp path to capability checks, not '/'","Pin framework versions and mount tables together: capability probes became common in Hadoop 3.3+","Use linkMergeSlash when frameworks probe root capabilities"],"tags":["viewfs","hadoop","capability","mount-table","configuration"],"backgroundTag":"viewfs-not-in-mountpoint","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}