{"record":{"id":"f7e21a537ac351ed","repo":"apache/beam","slug":"rename-operation-failed","errorCode":null,"errorMessage":"Rename operation failed","messagePattern":"Rename operation failed","errorType":"exception","errorClass":"BeamIOError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/io/aws/s3filesystem.py","lineNumber":221,"sourceCode":"    \"\"\"Rename the files at the source list to the destination list.\n    Source and destination lists should be of the same size.\n\n    Args:\n      source_file_names: List of file paths that need to be moved\n      destination_file_names: List of destination_file_names for the files\n\n    Raises:\n      ``BeamIOError``: if any of the rename operations fail\n    \"\"\"\n    if not len(source_file_names) == len(destination_file_names):\n      message = 'Unable to rename unequal number of sources and destinations'\n      raise BeamIOError(message)\n    src_dest_pairs = list(zip(source_file_names, destination_file_names))\n    results = s3io.S3IO(options=self._options).rename_files(src_dest_pairs)\n    exceptions = {(src, dest): error\n                  for (src, dest, error) in results if error is not None}\n    if exceptions:\n      raise BeamIOError(\"Rename operation failed\", exceptions)\n\n  def exists(self, path):\n    \"\"\"Check if the provided path exists on the FileSystem.\n\n    Args:\n      path: string path that needs to be checked.\n\n    Returns: boolean flag indicating if path exists\n    \"\"\"\n    try:\n      return s3io.S3IO(options=self._options).exists(path)\n    except Exception as e:  # pylint: disable=broad-except\n      raise BeamIOError(\"exists() operation failed\", {path: e})\n\n  def size(self, path):\n    \"\"\"Get size of path on the FileSystem.\n\n    Args:","sourceCodeStart":203,"sourceCodeEnd":239,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/aws/s3filesystem.py#L203-L239","documentation":"Raised by S3FileSystem.rename when at least one of the pairwise S3 rename (copy+delete) operations failed server-side or client-side. BeamIOError carries a dict of (src,dest) -> exception details so callers can see which pairs failed.","triggerScenarios":"Calling rename() where S3 copy/delete fails for any pair: source object missing, destination bucket not writable, SSE/region mismatch making copy fail, or throttling during bulk rename.","commonSituations":"Renaming files that another process deleted concurrently; renaming across buckets with different permissions; large batch renames hitting S3 rate limits; typo in destination bucket name.","solutions":["Inspect BeamIOError.exception_details to identify failed (src,dest) pairs and the underlying cause","Verify the source objects exist (fs.exists) and the destination bucket/permissions allow copy and delete","Retry the failed subset after addressing the cause","Check SSE configuration and bucket region compatibility for copy operations"],"exampleFix":"// before\nfs.rename(sources, dests)  # may raise with partial failures\n// after\nfrom apache_beam.io.filesystem import BeamIOError\ntry:\n    fs.rename(sources, dests)\nexcept BeamIOError as e:\n    for (src, dest), err in (e.exception_details or {}).items():\n        print(f'rename {src} -> {dest} failed: {err}')","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    fs.rename(srcs, dsts)\nexcept BeamIOError as e:\n    failed = (e.exception_details or {}).items()\n    for (src, dst), err in failed:\n        handle_failure(src, dst, err)","preventionTips":["Pre-check sources exist and destination buckets are writable","Batch large renames to limit blast radius and rate limits"],"tags":["s3","io","bulk-operation","aws"],"backgroundTag":"api-error-response","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"}