apache/hadoop · error · FileNotFoundException

Parent directory doesn't exist: <parentPath>

Error message

Parent directory doesn't exist: <parentPath>

What it means

Error "Parent directory doesn't exist: <parentPath>" thrown in apache/hadoop.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java:2046

        blocksize,
        inode.getModificationTime(snapshot),
        inode.getAccessTime(snapshot),
        inode.getFsPermission(snapshot),
        inode.getUserName(snapshot),
        inode.getGroupName(snapshot),
        symlink,
        new Path(iip.getPath()));
  }

  /**
   * Verify that parent directory of src exists.
   */
  void verifyParentDir(INodesInPath iip)
      throws FileNotFoundException, ParentNotDirectoryException {
    if (iip.length() > 2) {
      final INode parentNode = iip.getINode(-2);
      if (parentNode == null) {
        throw new FileNotFoundException("Parent directory doesn't exist: "
            + iip.getParentPath());
      } else if (!parentNode.isDirectory()) {
        throw new ParentNotDirectoryException("Parent path is not a directory: "
            + iip.getParentPath());
      }
    }
  }

  /** Allocate a new inode ID. */
  long allocateNewInodeId() {
    return inodeId.nextValue();
  }

  /** @return the last inode ID. */
  public long getLastInodeId() {
    return inodeId.getCurrentValue();
  }

View on GitHub (pinned to 2add963021)

Solutions

  1. Create the parent directory first with 'hdfs dfs -mkdir -p'.

When it happens

Trigger: Creating a file or directory whose parent path does not exist.

Common situations: See trigger scenarios.


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