{"record":{"id":"f9a02562efd83707","repo":"apache/hadoop","slug":"a-mount-path-file-dir-already-exist-with-the-requ-f9a025","errorCode":null,"errorMessage":"A mount path(file/dir) already exist with the requested path: {}","messagePattern":"A mount path\\(file/dir\\) already exist with the requested path: (.+?)","errorType":"exception","errorClass":"FileAlreadyExistsException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java","lineNumber":1015,"sourceCode":"    @Override\n    public FSDataOutputStream createInternal(final Path f,\n        final EnumSet<CreateFlag> flag, final FsPermission absolutePermission,\n        final int bufferSize, final short replication, final long blockSize,\n        final Progressable progress, final ChecksumOpt checksumOpt,\n        final boolean createParent) throws AccessControlException,\n        FileAlreadyExistsException, FileNotFoundException,\n        ParentNotDirectoryException, UnsupportedFileSystemException,\n        UnresolvedLinkException, IOException {\n      Preconditions.checkNotNull(f, \"File cannot be null.\");\n      if (InodeTree.SlashPath.equals(f)) {\n        throw new FileAlreadyExistsException(\n            \"/ is not a file. The directory / already exist at: \"\n                + theInternalDir.fullPath);\n      }\n\n      if (this.fsState.getRootFallbackLink() != null) {\n        if (theInternalDir.getChildren().containsKey(f.getName())) {\n          throw new FileAlreadyExistsException(\n              \"A mount path(file/dir) already exist with the requested path: \"\n                  + theInternalDir.getChildren().get(f.getName()).fullPath);\n        }\n\n        AbstractFileSystem linkedFallbackFs =\n            this.fsState.getRootFallbackLink().getTargetFileSystem();\n        Path parent = Path.getPathWithoutSchemeAndAuthority(\n            new Path(theInternalDir.fullPath));\n        String leaf = f.getName();\n        Path fileToCreate = new Path(parent, leaf);\n\n        try {\n          return linkedFallbackFs\n              .createInternal(fileToCreate, flag, absolutePermission,\n                  bufferSize, replication, blockSize, progress, checksumOpt,\n                  true);\n        } catch (IOException e) {\n          StringBuilder msg =","sourceCodeStart":997,"sourceCodeEnd":1033,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java#L997-L1033","documentation":"In InternalDirOfViewFs.createInternal, when a root fallback link exists, creation inside an internal dir is allowed to fall through to the fallback cluster — but only if the file name does not collide with an existing child of the internal dir. If theInternalDir.getChildren() contains f.getName() (i.e. a mount point with that name already exists under this dir), it throws FileAlreadyExistsException(\"A mount path(file/dir) already exist with the requested path: <childFullPath>\") to keep the mount namespace and fallback namespace from diverging.","triggerScenarios":"With fs.viewfs.mounttable.<n>.linkFallback set, creating viewfs:///data when /data is also a mount link under the same internal dir; writing via fallback into names that shadow mount points.","commonSituations":"Clusters that adopted linkFallback (HADOOP-16598) so tools can write anywhere, then tools create directories whose names equal configured mount points; ambiguous paths after mount-table updates.","solutions":["Choose a file/dir name that is not a configured mount point under that parent","Create the path on the backing cluster directly (bypass viewfs) if the collision is intentional","Remove or rename the conflicting mount-table entry (fs.viewfs.mounttable.<n>.link.<name>)"],"exampleFix":"// before: /data is a mount point and fallback exists\nfc.create(new Path(\"viewfs:///data\"), EnumSet.of(CreateFlag.CREATE)); // throws\n\n// after: pick a non-conflicting name\nfc.create(new Path(\"viewfs:///data_archive\"), EnumSet.of(CreateFlag.CREATE));","handlingStrategy":"validation","validationCode":"static boolean nameCollidesWithMount(ViewFileSystem vfs, Path parent, Path file) {\n  String child = file.getName();\n  String ps = parent.isRoot() ? \"\" : parent.toUri().getPath();\n  String candidate = (ps + \"/\" + child).replaceAll(\"//+\", \"/\");\n  return vfs.getMountPoints().stream()\n      .anyMatch(mp -> mp.getMountedOnPath().toUri().getPath().equals(candidate));\n}\n// if (nameCollidesWithMount(vfs, parent, f)) choose another name before create","typeGuard":null,"tryCatchPattern":"try {\n  out = fc.create(f, EnumSet.of(CreateFlag.CREATE));\n} catch (FileAlreadyExistsException fae) {\n  if (fae.getMessage().contains(\"A mount path(file/dir) already exist\")) { /* name shadows a mount point */ }\n}","preventionTips":["When linkFallback is enabled, reserve mount-point names as immutable in tooling","Prefer creating data under names that cannot collide with configured links (suffix them)"],"tags":["viewfs","mount-table","file-exists","fallback-link","hadoop-common"],"backgroundTag":"file-already-exists","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}