{"record":{"id":"fdecf2d8036bc13a","repo":"apache/hadoop","slug":"getlinktarget-on-path-path-is-not-within-a-mou","errorCode":null,"errorMessage":"getLinkTarget on path `<path>' is not within a mount point","messagePattern":"getLinkTarget on path `<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":1328,"sourceCode":"   */\n  @Override\n  public long getUsed() throws IOException {\n    InodeTree.ResolveResult<FileSystem> res = fsState.resolve(\n        getUriPath(InodeTree.SlashPath), true);\n    if (res.isInternalDir()) {\n      throw new NotInMountpointException(InodeTree.SlashPath, \"getUsed\");\n    } else {\n      return res.targetFileSystem.getUsed();\n    }\n  }\n\n  @Override\n  public Path getLinkTarget(Path path) throws IOException {\n    InodeTree.ResolveResult<FileSystem> res;\n    try {\n      res = fsState.resolve(getUriPath(path), true);\n    } catch (FileNotFoundException e) {\n      throw new NotInMountpointException(path, \"getLinkTarget\");\n    }\n    return res.targetFileSystem.getLinkTarget(res.remainingPath);\n  }\n\n  /**\n   * Reject the concat operation; forward the rest to the viewed FS.\n   * @param path path to query the capability of.\n   * @param capability string to query the stream support for.\n   * @return the capability\n   * @throws IOException if there is no resolved FS, or it raises an IOE.\n   */\n  @Override\n  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.","sourceCodeStart":1310,"sourceCodeEnd":1346,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java#L1310-L1346","documentation":"ViewFileSystem.getLinkTarget(Path) resolves the path first; a FileNotFoundException from resolve() (no mount point covers the path) is translated into NotInMountpointException('getLinkTarget on path ... is not within a mount point'). Viewfs can only follow symlinks that live inside a mounted file system, so it must reject paths that map to no target.","triggerScenarios":"readlink/getLinkTarget calls on a viewfs path that is outside every mount link, for example via FileContext.getLinkTarget() or symlink-aware input formats resolving a link placed at the viewfs root or in an unmounted directory.","commonSituations":"Symlinks created at viewfs root before the mount table covered that path; jobs using FileContext with viewfs URIs that resolve link targets on staging paths not in the mount table; partial mount tables during staged migrations.","solutions":["Ensure the path containing the symlink is mounted (add the fs.viewfs.mounttable.default.link.* entry)","Resolve the symlink inside the target file system by operating on the mounted child path directly","Configure linkMergeSlash so every path resolves to a backing cluster","Catch NotInMountpointException (subclass of UnsupportedOperationException) in symlink-handling utilities and report the unmounted path"],"exampleFix":"// before\nPath t = fc.getLinkTarget(new Path(\"viewfs://cluster/lnk\")); // throws if path unmounted\n\n// after\nPath p = new Path(\"viewfs://cluster/lnk\");\nPath t;\ntry {\n  t = fc.getLinkTarget(p);\n} catch (UnresolvedLinkException | UnsupportedOperationException e) {\n  t = null; // path not covered by viewfs; handle absence of symlink\n}","handlingStrategy":"try-catch","validationCode":"// Only call getLinkTarget on paths that resolve under a mount\nif (!fs.exists(p)) {\n  throw new FileNotFoundException(p + \" not covered by viewfs mount table\");\n}\nPath t = fc.getLinkTarget(p);","typeGuard":null,"tryCatchPattern":"try {\n  Path target = fc.getLinkTarget(p);\n} catch (UnresolvedLinkException | UnsupportedOperationException e) {\n  // path is not inside any mount; no symlink semantics available\n  target = null;\n}","preventionTips":["Place symlinks inside mounted directories, never at virtual roots","Test symlink workflows after every mount-table change","Treat link-target failures as mount-coverage bugs, not symlink corruption"],"tags":["viewfs","hadoop","symlink","mount-table","configuration"],"backgroundTag":"viewfs-not-in-mountpoint","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}