{"record":{"id":"6f89ec0802ee11f5","repo":"apache/hadoop","slug":"rename-source-cannot-be-the-root","errorCode":null,"errorMessage":"rename source cannot be the root","messagePattern":"rename source cannot be the root","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirRenameOp.java","lineNumber":613,"sourceCode":"  }\n\n  private static void validateRenameSource(FSDirectory fsd,\n      INodesInPath srcIIP, List<INodeDirectory> snapshottableDirs)\n      throws IOException {\n    String error;\n    final INode srcInode = srcIIP.getLastINode();\n    // validate source\n    if (srcInode == null) {\n      error = \"rename source \" + srcIIP.getPath() + \" is not found.\";\n      NameNode.stateChangeLog.warn(\"DIR* FSDirectory.unprotectedRenameTo: \"\n          + error);\n      throw new FileNotFoundException(error);\n    }\n    if (srcIIP.length() == 1) {\n      error = \"rename source cannot be the root\";\n      NameNode.stateChangeLog.warn(\"DIR* FSDirectory.unprotectedRenameTo: \"\n          + error);\n      throw new IOException(error);\n    }\n    // srcInode and its subtree cannot contain snapshottable directories with\n    // snapshots\n    FSDirSnapshotOp.checkSnapshot(fsd, srcIIP, snapshottableDirs);\n  }\n\n  private static void validateNestSnapshot(FSDirectory fsd, String srcPath,\n      INodeDirectory dstParent, List<INodeDirectory> snapshottableDirs)\n      throws SnapshotException {\n\n    if (fsd.getFSNamesystem().getSnapshotManager().isAllowNestedSnapshots()) {\n      return;\n    }\n\n    /*\n     * snapshottableDirs is a list of snapshottable directory (child of rename\n     * src) which do not have snapshots yet. If this list is not empty, that\n     * means rename src has snapshottable descendant directories.","sourceCodeStart":595,"sourceCodeEnd":631,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirRenameOp.java#L595-L631","documentation":"Error \"rename source cannot be the root\" thrown in apache/hadoop.","triggerScenarios":"Attempting to rename the filesystem root ('/').","commonSituations":"See trigger scenarios.","solutions":["The root directory cannot be renamed; select a subdirectory as the source."],"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-22T20:17:22.307Z"}