{"record":{"id":"913ebdbe64a96f11","repo":"apache/hadoop","slug":"doesn-t-support-renamesnapshot","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/AbstractFileSystem.java","lineNumber":1497,"sourceCode":"   */\n  public Path createSnapshot(final Path path, final String snapshotName)\n      throws IOException {\n    throw new UnsupportedOperationException(getClass().getSimpleName()\n        + \" doesn't support createSnapshot\");\n  }\n\n  /**\n   * The specification of this method matches that of\n   * {@link FileContext#renameSnapshot(Path, String, String)}.\n   *\n   * @param path the path.\n   * @param snapshotOldName snapshot old name.\n   * @param snapshotNewName snapshot new name.\n   * @throws IOException raised on errors performing I/O.\n   */\n  public void renameSnapshot(final Path path, final String snapshotOldName,\n      final String snapshotNewName) throws IOException {\n    throw new UnsupportedOperationException(getClass().getSimpleName()\n        + \" doesn't support renameSnapshot\");\n  }\n\n  /**\n   * The specification of this method matches that of\n   * {@link FileContext#deleteSnapshot(Path, String)}.\n   *\n   * @param snapshotDir snapshot dir.\n   * @param snapshotName snapshot name.\n   * @throws IOException raised on errors performing I/O.\n   */\n  public void deleteSnapshot(final Path snapshotDir, final String snapshotName)\n      throws IOException {\n    throw new UnsupportedOperationException(getClass().getSimpleName()\n        + \" doesn't support deleteSnapshot\");\n  }\n\n  /**","sourceCodeStart":1479,"sourceCodeEnd":1515,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java#L1479-L1515","documentation":"AbstractFileSystem.renameSnapshot(Path, String, String) is a default stub that throws UnsupportedOperationException with the implementing class name filled in. Renaming snapshots is part of the HDFS-only snapshot API; no other AbstractFileSystem implementation provides it. The error indicates the path is on a filesystem without snapshot support, not that the snapshot name is wrong (that yields SnapshotException on HDFS).","triggerScenarios":"FileContext.renameSnapshot(path, \"old\", \"new\") against local/object-store/ftp schemes, or a viewfs path resolving to a non-HDFS target. Retrying a failed HDFS snapshot workflow after fs.defaultFS was repointed to file:// in a test config.","commonSituations":"Snapshot lifecycle management (backup rotation scripts renaming daily snapshots) run in local unit tests or against object stores after a config migration; CI environments using file:// as defaultFS.","solutions":["Verify the path scheme is hdfs:// and route snapshot-rename operations there.","Use DistributedFileSystem.renameSnapshot (or the `hdfs dfs -renameSnapshot` shell) so the HDFS-only contract is explicit.","Guard management code by scheme and log/skip on unsupported filesystems.","Catch UnsupportedOperationException as a control-flow signal that this store has no snapshots to rename."],"exampleFix":"// before\nfc.renameSnapshot(dir, \"daily-1\", \"daily-2\"); // throws on file://\n\n// after\ntry {\n  fc.renameSnapshot(dir, \"daily-1\", \"daily-2\");\n} catch (UnsupportedOperationException e) {\n  LOG.warn(\"Snapshot rename skipped: {} has no snapshot support\", dir);\n}","handlingStrategy":"validation","validationCode":"static boolean isSnapshotCapable(Path p) {\n  String scheme = p.toUri().getScheme();\n  return \"hdfs\".equals(scheme) || \"webhdfs\".equals(scheme);\n}","typeGuard":null,"tryCatchPattern":"try {\n  fc.renameSnapshot(dir, oldName, newName);\n} catch (UnsupportedOperationException e) {\n  // store has no snapshots: nothing to rename\n}","preventionTips":["Only issue snapshot renames for paths already known to be HDFS","Keep snapshot name state per scheme so rename is never attempted where create failed"],"tags":["hadoop","filesystem","hdfs-snapshot","filecontext","unsupportedoperationexception"],"backgroundTag":"snapshots-unsupported","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}