{"record":{"id":"f891169334dad8c1","repo":"apache/beam","slug":"support-for-move-options-is-not-yet-implemented","errorCode":null,"errorMessage":"Support for move options is not yet implemented.","messagePattern":"Support for move options is not yet implemented\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/io/LocalFileSystem.java","lineNumber":172,"sourceCode":"      }\n      // Copy the source file, replacing the existing destination.\n      // Paths.get(x) will not work on Windows OSes cause of the \":\" after the drive letter.\n      Files.copy(\n          src.getPath(),\n          dst.getPath(),\n          StandardCopyOption.REPLACE_EXISTING,\n          StandardCopyOption.COPY_ATTRIBUTES);\n    }\n  }\n\n  @Override\n  protected void rename(\n      List<LocalResourceId> srcResourceIds,\n      List<LocalResourceId> destResourceIds,\n      MoveOptions... moveOptions)\n      throws IOException {\n    if (moveOptions.length > 0) {\n      throw new UnsupportedOperationException(\"Support for move options is not yet implemented.\");\n    }\n    checkArgument(\n        srcResourceIds.size() == destResourceIds.size(),\n        \"Number of source files %s must equal number of destination files %s\",\n        srcResourceIds.size(),\n        destResourceIds.size());\n    int numFiles = srcResourceIds.size();\n    for (int i = 0; i < numFiles; i++) {\n      LocalResourceId src = srcResourceIds.get(i);\n      LocalResourceId dst = destResourceIds.get(i);\n      LOG.debug(\"Renaming {} to {}\", src, dst);\n      File parent = dst.getCurrentDirectory().getPath().toFile();\n      if (!parent.exists()) {\n        checkArgument(\n            parent.mkdirs() || parent.exists(),\n            \"Unable to make output directory %s in order to move into file %s\",\n            parent,\n            dst.getPath());","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/io/LocalFileSystem.java#L154-L190","documentation":"LocalFileSystem.rename throws UnsupportedOperationException whenever any MoveOptions are passed: the local filesystem's rename implementation only supports a plain copy-and-delete and ignores/never implements move-variant semantics (e.g. no-replace). The moveOptions varargs are the input at fault — this is an explicit unimplemented-capability guard, not a data error.","triggerScenarios":"Calling FileSystems.rename(srcList, destList, MoveOptions... ) with non-empty move options while the underlying filesystem is the LocalFileSystem — e.g. requesting IGNORE_MISSING_TARGETS or SKIP_DIRECTORY_TREES on local paths.","commonSituations":"Writing generic rename code that passes MoveOptions for cloud filesystems but is exercised against local files in tests; new code using options introduced for other FileSystem implementations.","solutions":["Call rename without MoveOptions when using LocalFileSystem","Guard the call: only pass MoveOptions for filesystems that support them (check the implementation)","Handle local moves yourself with java.nio.file.Files.move if you need option-like semantics"],"exampleFix":"// before\nFileSystems.rename(srcs, dests, MoveOptions.IGNORE_MISSING_TARGETS);\n// after\nif (isLocalScheme(srcs.get(0))) {\n  FileSystems.rename(srcs, dests); // no options\n} else {\n  FileSystems.rename(srcs, dests, MoveOptions.IGNORE_MISSING_TARGETS);\n}","handlingStrategy":"try-catch","validationCode":"// Only pass MoveOptions for filesystems known to support them\nboolean local = \"file\".equals(URI.create(srcResourceIds.get(0).toString()).getScheme());\nif (local && moveOptions.length > 0) {\n  throw new IllegalArgumentException(\"LocalFileSystem does not support MoveOptions\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  FileSystems.rename(srcs, dests, moveOptions);\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().contains(\"move options\")) {\n    FileSystems.rename(srcs, dests); // fall back to plain rename\n  } else {\n    throw e;\n  }\n}","preventionTips":["Only pass MoveOptions when targeting cloud filesystems that document support","Keep rename call sites scheme-aware (branch local vs cloud)","Add tests covering rename for each filesystem scheme you support","Check the LocalFileSystem javadoc for unsupported features before use"],"tags":["java","apache-beam","local-filesystem","rename","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}