{"record":{"id":"60c70a4af2fdc667","repo":"apache/hadoop","slug":"directory-is-not-a-snapshottable-directory","errorCode":null,"errorMessage":"Directory is not a snapshottable directory: {}","messagePattern":"Directory is not a snapshottable directory: (.+?)","errorType":"exception","errorClass":"SnapshotException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirStatAndListingOp.java","lineNumber":314,"sourceCode":"\n  /**\n   * Get a listing of all the snapshots of a snapshottable directory\n   */\n  private static DirectoryListing getSnapshotsListing(\n      FSDirectory fsd, INodesInPath iip, byte[] startAfter)\n      throws IOException {\n    Preconditions.checkState(fsd.hasReadLock());\n    Preconditions.checkArgument(iip.isDotSnapshotDir(),\n        \"%s does not end with %s\",\n        iip.getPath(), HdfsConstants.SEPARATOR_DOT_SNAPSHOT_DIR);\n    // drop off the null .snapshot component\n    iip = iip.getParentINodesInPath();\n    final String dirPath = iip.getPath();\n    final INode node = iip.getLastINode();\n    final INodeDirectory dirNode = INodeDirectory.valueOf(node, dirPath);\n    final DirectorySnapshottableFeature sf = dirNode.getDirectorySnapshottableFeature();\n    if (sf == null) {\n      throw new SnapshotException(\n          \"Directory is not a snapshottable directory: \" + dirPath);\n    }\n    final ReadOnlyList<Snapshot> snapshots = sf.getSnapshotList();\n    int skipSize = ReadOnlyList.Util.binarySearch(snapshots, startAfter);\n    skipSize = skipSize < 0 ? -skipSize - 1 : skipSize + 1;\n    int numOfListing = Math.min(snapshots.size() - skipSize, fsd.getLsLimit());\n    final HdfsFileStatus listing[] = new HdfsFileStatus[numOfListing];\n    for (int i = 0; i < numOfListing; i++) {\n      Snapshot.Root sRoot = snapshots.get(i + skipSize).getRoot();\n      listing[i] = createFileStatus(fsd, iip, sRoot,\n          HdfsConstants.BLOCK_STORAGE_POLICY_ID_UNSPECIFIED, false, false);\n    }\n    return new DirectoryListing(\n        listing, snapshots.size() - skipSize - numOfListing);\n  }\n\n  /**\n   * Get a listing of the /.reserved directory.","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirStatAndListingOp.java#L296-L332","documentation":"Error \"Directory is not a snapshottable directory: {}\" thrown in apache/hadoop.","triggerScenarios":"Requesting a snapshot diff listing for a directory that is not snapshottable.","commonSituations":"See trigger scenarios.","solutions":["Enable snapshot capability on the directory with 'hdfs dfsadmin -allowSnapshot <path>' first.","Run the snapshot operation against a snapshottable 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-22T20:17:22.307Z"}