{"record":{"id":"255f0b0bd7f303b4","repo":"apache/hadoop","slug":"doesn-t-support-renamesnapshot-255f0b","errorCode":null,"errorMessage":"{} doesn't support renameSnapshot","messagePattern":"(.+?) doesn't support renameSnapshot","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java","lineNumber":3118,"sourceCode":"   */\n  public Path createSnapshot(Path path, String snapshotName)\n      throws IOException {\n    throw new UnsupportedOperationException(getClass().getSimpleName()\n        + \" doesn't support createSnapshot\");\n  }\n\n  /**\n   * Rename a snapshot.\n   * @param path The directory path where the snapshot was taken\n   * @param snapshotOldName Old name of the snapshot\n   * @param snapshotNewName New name of the snapshot\n   * @throws IOException IO failure\n   * @throws UnsupportedOperationException if the operation is unsupported\n   *         (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  /**","sourceCodeStart":3100,"sourceCodeEnd":3136,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileSystem.java#L3100-L3136","documentation":"FileSystem.renameSnapshot(Path, String, String) is optional; the base class throws UnsupportedOperationException with getClass().getSimpleName() + \" doesn't support renameSnapshot\". Only the HDFS snapshot implementations override it (DistributedFileSystem, WebHdfsFileSystem, and ViewFileSystem/ChRootedFileSystem/FilterFileSystem pass-throughs).","triggerScenarios":"Calling fs.renameSnapshot(dir, oldName, newName) on LocalFileSystem, S3A, ABFS, GCS, HarFileSystem, or any custom FileSystem that did not override the method; snapshot-management scripts run against a non-HDFS URI.","commonSituations":"Lifecycle automation that renames dated snapshots (snap-2024-01-01 -> snap-current) executed in the wrong environment; the same code path working on the HDFS cluster but failing in local integration tests.","solutions":["Guard with fs.hasPathCapability(dir, CommonPathCapabilities.FS_SNAPSHOTS) or instanceof DistributedFileSystem","Point the tooling at the HDFS namespace it was written for (fix fs.defaultFS / explicit hdfs:// path)","Catch UnsupportedOperationException and skip the rename step for stores without snapshot support","Track snapshot names in your own catalog so renames become metadata-only operations"],"exampleFix":"// before\nfs.renameSnapshot(dir, \"snap-old\", \"snap-new\");\n// throws on non-HDFS stores\n\n// after\nif (fs instanceof DistributedFileSystem) {\n  fs.renameSnapshot(dir, \"snap-old\", \"snap-new\");\n} else {\n  catalog.renameSnapshot(dir, \"snap-old\", \"snap-new\"); // metadata indirection\n}","handlingStrategy":"try-catch","validationCode":"if (fs.hasPathCapability(dir, CommonPathCapabilities.FS_SNAPSHOTS)) {\n  fs.renameSnapshot(dir, oldName, newName);\n}","typeGuard":"static boolean supportsSnapshotRename(FileSystem fs) {\n  return fs instanceof DistributedFileSystem;\n}","tryCatchPattern":"try {\n  fs.renameSnapshot(dir, oldName, newName);\n} catch (UnsupportedOperationException e) {\n  LOG.warn(\"Snapshot rename unsupported on {}; keeping name {}\", fs.getUri(), oldName);\n}","preventionTips":["Track snapshot names in an external catalog so renames stay portable","Run snapshot lifecycle automation only against HDFS namespaces","Treat UOE as a skip condition in retention/rename loops, not a fatal error"],"tags":["hadoop","filesystem","hdfs","snapshot","unsupportedoperationexception","rename"],"backgroundTag":"filesystem-snapshot-unsupported","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}