{"record":{"id":"23c6f17dac743358","repo":"apache/hadoop","slug":"failed-to-delete-snapshot-from-since-is-n","errorCode":null,"errorMessage":"Failed to delete snapshot {} from {} since {} is not the first snapshot (={}) and dfs.namenode.snapshot.deletion.ordered is {}","messagePattern":"Failed to delete snapshot (.+?) from (.+?) since (.+?) is not the first snapshot \\(=(.+?)\\) and dfs\\.namenode\\.snapshot\\.deletion\\.ordered is (.+?)","errorType":"exception","errorClass":"SnapshotException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/SnapshotManager.java","lineNumber":364,"sourceCode":"      return;\n    }\n    // prior must not exist\n    if (prior != Snapshot.NO_SNAPSHOT_ID) {\n      throw new SnapshotException(\"Failed to removeSnapshot \"\n          + snapshotName + \" from \" + dir.getFullPathName()\n          + \": Unexpected prior (=\" + prior + \") when \"\n          + DFS_NAMENODE_SNAPSHOT_DELETION_ORDERED\n          + \" is \" + isSnapshotDeletionOrdered());\n    }\n  }\n\n  void assertFirstSnapshot(INodeDirectory dir,\n      DirectorySnapshottableFeature snapshottable, Snapshot snapshot)\n      throws SnapshotException {\n    final INodeDirectoryAttributes first\n        = snapshottable.getDiffs().getFirstSnapshotINode();\n    if (snapshot.getRoot() != first) {\n      throw new SnapshotException(\"Failed to delete snapshot \" + snapshot\n          + \" from \" + dir.getFullPathName() + \" since \" + snapshot\n          + \" is not the first snapshot (=\" + first + \") and \"\n          + DFS_NAMENODE_SNAPSHOT_DELETION_ORDERED\n          + \" is \" + isSnapshotDeletionOrdered());\n    }\n  }\n\n  /**\n   * Return CaptureOpenFiles config value.\n   */\n  boolean captureOpenFiles() {\n    return captureOpenFiles;\n  }\n\n  @VisibleForTesting\n  int getMaxSnapshotLimit() {\n    return maxSnapshotLimit;\n  }","sourceCodeStart":346,"sourceCodeEnd":382,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/SnapshotManager.java#L346-L382","documentation":"Error \"Failed to delete snapshot {} from {} since {} is not the first snapshot (={}) and dfs.namenode.snapshot.deletion.ordered is {}\" thrown in apache/hadoop.","triggerScenarios":"A snapshot other than the first is deleted while ordered snapshot deletion is configured.","commonSituations":"Removing a middle/newest snapshot with dfs.namenode.snapshot.deletion.ordered=true.","solutions":["Delete the earliest snapshot first when dfs.namenode.snapshot.deletion.ordered is enabled, or disable ordered deletion."],"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"}