{"record":{"id":"0fd14032efd6b0d1","repo":"apache/hadoop","slug":"destination-has-no-parent","errorCode":null,"errorMessage":"destination has no parent ","messagePattern":"destination has no parent ","errorType":"exception","errorClass":"RenameFailedException","httpStatus":null,"severity":"error","filePath":"hadoop-cloud-storage-project/hadoop-huaweicloud/src/main/java/org/apache/hadoop/fs/obs/OBSObjectBucketUtils.java","lineNumber":200,"sourceCode":"\n    return true;\n  }\n\n  private static void checkDestinationParent(final OBSFileSystem owner,\n      final Path src,\n      final Path dst) throws IOException {\n    Path parent = dst.getParent();\n    if (!OBSCommonUtils.pathToKey(owner, parent).isEmpty()) {\n      try {\n        FileStatus dstParentStatus = owner.getFileStatus(\n            dst.getParent());\n        if (!dstParentStatus.isDirectory()) {\n          throw new ParentNotDirectoryException(\n              \"destination parent [\" + dst.getParent()\n                  + \"] is not a directory\");\n        }\n      } catch (FileNotFoundException e2) {\n        throw new RenameFailedException(src, dst,\n            \"destination has no parent \");\n      }\n    }\n  }\n\n  /**\n   * Implement rename file.\n   *\n   * @param owner     OBS File System instance\n   * @param srcKey    source object key\n   * @param dstKey    destination object key\n   * @param srcStatus source object status\n   * @throws IOException any problem with rename operation\n   */\n  private static void renameFile(final OBSFileSystem owner,\n      final String srcKey,\n      final String dstKey,\n      final FileStatus srcStatus)","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-cloud-storage-project/hadoop-huaweicloud/src/main/java/org/apache/hadoop/fs/obs/OBSObjectBucketUtils.java#L182-L218","documentation":"In checkDestinationParent, when getFileStatus on the destination parent raises FileNotFoundException, the code converts it to RenameFailedException('destination has no parent ') (note the trailing space in the message). Hadoop rename never creates missing intermediate directories, so every ancestor of the destination must already exist as a directory.","triggerScenarios":"fs.rename(src, '/a/b/c/file') when /a/b does not exist; moving data into a newly configured bucket whose directory tree was never created; output paths built with a missing or misspelled intermediate component.","commonSituations":"Jobs ported from HDFS where the framework pre-created output directories; first run against a fresh bucket; path templates that drop a component for edge-case values (e.g., empty partition field).","solutions":["Create the parent chain before the rename: fs.mkdirs(dst.getParent())","Fix the path construction that omits or misspells an intermediate directory","Verify the bucket layout with listStatus on the parent prefix before moving data"],"exampleFix":"// before\nfs.rename(src, new Path(\"/outputs/2024/01/data\")); // /outputs/2024 does not exist\n\n// after\nPath dst = new Path(\"/outputs/2024/01/data\");\nfs.mkdirs(dst.getParent());\nfs.rename(src, dst);","handlingStrategy":"validation","validationCode":"Path parent = dst.getParent();\nif (parent != null && !fs.exists(parent)) {\n  fs.mkdirs(parent); // Hadoop rename does not create parents\n}","typeGuard":null,"tryCatchPattern":"try {\n  fs.rename(src, dst);\n} catch (RenameFailedException e) {\n  if (e.getMessage().trim().equals(\"destination has no parent\")) {\n    fs.mkdirs(dst.getParent());\n    fs.rename(src, dst); // retry once after creating the chain\n  } else {\n    throw e;\n  }\n}","preventionTips":["Always mkdirs the destination parent before rename on object stores","Log and inspect computed destination paths for missing components","Do not port HDFS assumptions: object-store rename never creates directories"],"tags":["hadoop","obs","rename","missing-directory","parent-directory"],"backgroundTag":"missing-parent-directory","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}