{"record":{"id":"f4afb6d319f7f73e","repo":"apache/hadoop","slug":"getxattrs-on-path-is-not-within-a-mount-point","errorCode":null,"errorMessage":"getXAttrs on path `{}' is not within a mount point","messagePattern":"getXAttrs on path `(.+?)' 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":1845,"sourceCode":"          .addEntries(AclUtil.getMinimalAcl(PERMISSION_555))\n          .stickyBit(false).build();\n    }\n\n    @Override\n    public void setXAttr(Path path, String name, byte[] value,\n        EnumSet<XAttrSetFlag> flag) throws IOException {\n      checkPathIsSlash(path);\n      throw readOnlyMountTable(\"setXAttr\", path);\n    }\n\n    @Override\n    public byte[] getXAttr(Path path, String name) throws IOException {\n      throw new NotInMountpointException(path, \"getXAttr\");\n    }\n\n    @Override\n    public Map<String, byte[]> getXAttrs(Path path) throws IOException {\n      throw new NotInMountpointException(path, \"getXAttrs\");\n    }\n\n    @Override\n    public Map<String, byte[]> getXAttrs(Path path, List<String> names)\n        throws IOException {\n      throw new NotInMountpointException(path, \"getXAttrs\");\n    }\n\n    @Override\n    public List<String> listXAttrs(Path path) throws IOException {\n      throw new NotInMountpointException(path, \"listXAttrs\");\n    }\n\n    @Override\n    public void removeXAttr(Path path, String name) throws IOException {\n      checkPathIsSlash(path);\n      throw readOnlyMountTable(\"removeXAttr\", path);\n    }","sourceCodeStart":1827,"sourceCodeEnd":1863,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java#L1827-L1863","documentation":"ViewFileSystem is a mount-table overlay: each path must resolve to a child FileSystem via a configured link before an operation can be forwarded. getXAttr(Path,String) on ViewFileSystem's InternalDirOfViewFs throws NotInMountpointException when the path resolves only to a virtual internal mount-table directory (e.g. \"/\" or an ancestor like /data when only /data/ds1 is mounted). Note NotInMountpointException extends UnsupportedOperationException, so it is unchecked and slips past handlers that only catch IOException.","triggerScenarios":"fs.getXAttr(new Path(\"/\"), \"user.myattr\") or fs.getXAttr(new Path(\"/data\"), name) on a viewfs:// FileSystem where no link covers /data itself; any xattr read executed while the resolver lands on an internal dir (res.isInternalDir()).","commonSituations":"distCp -p (preserve xattrs), Hive/Spark jobs, or Ranger/Atlas tag-sync utilities walking a viewfs:// defaultFS root; a mount-table entry missing for the queried prefix after a federation config refresh.","solutions":["Call getXAttr on a concrete mounted path (below a mount point) rather than the virtual parent/root","Add a mount-table link covering the path: fs.viewfs.mounttable.<cluster>.link.<path>=<target-uri>","Configure root coverage (fs.viewfs.mounttable.<cluster>.linkMergeSlash or linkFallback) so / resolves to a real FileSystem","Catch NotInMountpointException and treat it as 'no xattrs' when walking trees"],"exampleFix":"// before\nbyte[] v = fs.getXAttr(new Path(\"/\"), \"user.tag\"); // throws NotInMountpointException\n\n// after\ntry {\n  byte[] v = fs.getXAttr(p, \"user.tag\");\n} catch (NotInMountpointException e) {\n  v = null; // virtual mount-table dir: no xattrs\n}","handlingStrategy":"try-catch","validationCode":"static boolean isInMountPoint(ViewFileSystem vfs, Path p) {\n  String s = p.toUri().getPath();\n  for (MountPoint mp : vfs.getMountPoints()) {\n    String m = mp.getMountedOnPath().toUri().getPath();\n    if (s.equals(m) || s.startsWith(m.endsWith(\"/\") ? m : m + \"/\")) return true;\n  }\n  return false;\n}\n// if (!isInMountPoint(vfs, p)) skip xattr read","typeGuard":null,"tryCatchPattern":"try {\n  byte[] v = fs.getXAttr(p, name);\n} catch (NotInMountpointException e) { // unchecked: NOT caught by IOException handlers\n  // virtual mount-table dir -> treat as absent\n}","preventionTips":["Never issue xattr calls on the viewfs root or unmounted ancestor dirs","Remember NotInMountpointException extends UnsupportedOperationException — add explicit catches where trees are walked","Keep mount-table config (core-site.xml link entries) versioned with the tools that depend on it"],"tags":["viewfs","mount-table","xattr","hadoop-common","java"],"backgroundTag":"viewfs-not-in-mountpoint","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}