{"record":{"id":"6dc79a83bebd86bd","repo":"apache/hadoop","slug":"snapshot-from-should-be-newer-than-to","errorCode":null,"errorMessage":"Snapshot \" + from + \" should be newer than \" + to","messagePattern":"Snapshot \" \\+ from \\+ \" should be newer than \" \\+ to","errorType":"validation","errorClass":"HadoopIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/DistCpSync.java","lineNumber":137,"sourceCode":"\n    final String from = getSnapshotName(\n        context.getFromSnapshot());\n    final String to = getSnapshotName(\n        context.getToSnapshot());\n\n    try {\n      final FileStatus fromSnapshotStat =\n          snapshotDiffFs.getFileStatus(getSnapshotPath(snapshotDiffDir, from));\n\n      final FileStatus toSnapshotStat =\n          snapshotDiffFs.getFileStatus(getSnapshotPath(snapshotDiffDir, to));\n\n      if (isRdiff()) {\n        // If fromSnapshot isn't current dir then do a time check\n        if (!from.equals(\"\")\n            && fromSnapshotStat.getModificationTime() < toSnapshotStat\n            .getModificationTime()) {\n          throw new HadoopIllegalArgumentException(\"Snapshot \" + from\n              + \" should be newer than \" + to);\n        }\n      } else {\n        // If toSnapshot isn't current dir then do a time check\n        if(!to.equals(\"\")\n            && fromSnapshotStat.getModificationTime() > toSnapshotStat\n            .getModificationTime()) {\n          throw new HadoopIllegalArgumentException(\"Snapshot \" + to\n              + \" should be newer than \" + from);\n        }\n      }\n    } catch (FileNotFoundException nfe) {\n      throw new InvalidInputException(\"Input snapshot is not found\", nfe);\n    }\n\n    return true;\n  }\n","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/DistCpSync.java#L119-L155","documentation":"Error \"Snapshot \" + from + \" should be newer than \" + to\" thrown in apache/hadoop.","triggerScenarios":"-rdiff is given snapshots in the wrong chronological order.","commonSituations":"See trigger scenarios.","solutions":["Swap the snapshot arguments: the 'from' snapshot must be newer than 'to' for -rdiff.","Verify snapshot creation times with hdfs lsSnapshottableDir / snapshot listings."],"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"}