{"record":{"id":"635e554ba46f9910","repo":"apache/hadoop","slug":"is-not-a-directory-635e55","errorCode":null,"errorMessage":"{} (is not a directory)","messagePattern":"(.+?) \\(is not a directory\\)","errorType":"exception","errorClass":"ParentNotDirectoryException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSPermissionChecker.java","lineNumber":904,"sourceCode":"\n  // rudimentary permission-less directory check\n  private static void checkSimpleTraverse(INodesInPath iip)\n      throws UnresolvedPathException, ParentNotDirectoryException {\n    byte[][] components = iip.getPathComponents();\n    for (int i=0; i < iip.length() - 1; i++) {\n      INode inode = iip.getINode(i);\n      if (inode == null) {\n        break;\n      }\n      checkIsDirectory(inode, components, i);\n    }\n  }\n\n  private static void checkIsDirectory(INode inode, byte[][] components, int i)\n      throws UnresolvedPathException, ParentNotDirectoryException {\n    if (inode != null && !inode.isDirectory()) {\n      checkNotSymlink(inode, components, i);\n      throw new ParentNotDirectoryException(\n          getPath(components, 0, i) + \" (is not a directory)\");\n    }\n  }\n\n  private static void checkNotSymlink(INode inode, byte[][] components, int i)\n      throws UnresolvedPathException {\n    if (inode != null && inode.isSymlink()) {\n      final int last = components.length - 1;\n      final String path = getPath(components, 0, last);\n      final String preceding = getPath(components, 0, i - 1);\n      final String remainder = getPath(components, i + 1, last);\n      final String target = inode.asSymlink().getSymlinkString();\n      if (LOG.isDebugEnabled()) {\n        final String link = inode.getLocalName();\n        LOG.debug(\"UnresolvedPathException \" +\n            \" path: \" + path + \" preceding: \" + preceding +\n            \" count: \" + i + \" link: \" + link + \" target: \" + target +\n            \" remainder: \" + remainder);","sourceCodeStart":886,"sourceCodeEnd":922,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSPermissionChecker.java#L886-L922","documentation":"Error \"{} (is not a directory)\" thrown in apache/hadoop.","triggerScenarios":"A permission check or operation expects a directory component but the path resolves to a regular file.","commonSituations":"Using a file path as a parent directory in create/mkdirs, or traversing through a file as if it were a directory.","solutions":["Pass a directory path where a directory is required; the target inode is a file, not a directory."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}