{"record":{"id":"fd4891277e051baf","repo":"apache/hadoop","slug":"doesn-t-support-deletesnapshot-fd4891","errorCode":null,"errorMessage":"{} doesn't support deleteSnapshot","messagePattern":"(.+?) doesn't support deleteSnapshot","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java","lineNumber":3132,"sourceCode":"   *         (default outcome).\n   */\n  public void renameSnapshot(Path path, String snapshotOldName,\n      String snapshotNewName) throws IOException {\n    throw new UnsupportedOperationException(getClass().getSimpleName()\n        + \" doesn't support renameSnapshot\");\n  }\n\n  /**\n   * Delete a snapshot of a directory.\n   * @param path  The directory that the to-be-deleted snapshot belongs to\n   * @param snapshotName The name of the snapshot\n   * @throws IOException IO failure\n   * @throws UnsupportedOperationException if the operation is unsupported\n   *         (default outcome).\n   */\n  public void deleteSnapshot(Path path, String snapshotName)\n      throws IOException {\n    throw new UnsupportedOperationException(getClass().getSimpleName()\n        + \" doesn't support deleteSnapshot\");\n  }\n\n  /**\n   * Modifies ACL entries of files and directories.  This method can add new ACL\n   * entries or modify the permissions on existing ACL entries.  All existing\n   * ACL entries that are not specified in this call are retained without\n   * changes.  (Modifications are merged into the current ACL.)\n   *\n   * @param path Path to modify\n   * @param aclSpec List&lt;AclEntry&gt; describing modifications\n   * @throws IOException if an ACL could not be modified\n   * @throws UnsupportedOperationException if the operation is unsupported\n   *         (default outcome).\n   */\n  public void modifyAclEntries(Path path, List<AclEntry> aclSpec)\n      throws IOException {\n    throw new UnsupportedOperationException(getClass().getSimpleName()","sourceCodeStart":3114,"sourceCodeEnd":3150,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java#L3114-L3150","documentation":"FileSystem.deleteSnapshot(Path, String) is optional; the base class throws UnsupportedOperationException with getClass().getSimpleName() + \" doesn't support deleteSnapshot\". Only HDFS snapshot-capable clients (DistributedFileSystem, WebHdfsFileSystem, plus view/chroot/filter pass-throughs) implement it; everything else — including LocalFileSystem and object stores — throws.","triggerScenarios":"Calling fs.deleteSnapshot(dir, name) on file://, s3a://, abfs://, gs://, har:// or an unmodified custom FileSystem; retention/cleanup jobs that prune old snapshots run against the wrong scheme.","commonSituations":"Snapshot-retention cron jobs reused across environments; unit tests of backup tooling against RawLocalFileSystem; ViewFileSystem mounts backed by non-HDFS stores.","solutions":["Probe fs.hasPathCapability(dir, CommonPathCapabilities.FS_SNAPSHOTS) before calling","Run retention tooling only against the hdfs:// namespace (explicit scheme in the path avoids fs.defaultFS mistakes)","Catch UnsupportedOperationException and treat 'no snapshot support' as 'nothing to prune'","For object stores, implement retention over store-native versions or manifest-based backups"],"exampleFix":"// before\nfs.deleteSnapshot(dir, snapshotName); // throws on LocalFileSystem/S3A\n\n// after\nif (fs.hasPathCapability(dir, CommonPathCapabilities.FS_SNAPSHOTS)) {\n  fs.deleteSnapshot(dir, snapshotName);\n} else {\n  LOG.debug(\"{} has no snapshot support; skip prune\", fs.getUri());\n}","handlingStrategy":"try-catch","validationCode":"if (fs.hasPathCapability(dir, CommonPathCapabilities.FS_SNAPSHOTS)) {\n  fs.deleteSnapshot(dir, snapshotName);\n}","typeGuard":"static boolean supportsSnapshotDelete(FileSystem fs) {\n  return fs instanceof DistributedFileSystem;\n}","tryCatchPattern":"try {\n  fs.deleteSnapshot(dir, name);\n} catch (UnsupportedOperationException e) {\n  // store cannot have snapshots: nothing to delete, continue retention loop\n}","preventionTips":["In retention jobs, catch UOE per-store and continue rather than aborting the run","Point cleanup cron jobs at explicit hdfs:// URIs","For object stores, implement retention over store-native versioning instead of the FileSystem API"],"tags":["hadoop","filesystem","hdfs","snapshot","unsupportedoperationexception","retention"],"backgroundTag":"filesystem-snapshot-unsupported","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}