{"record":{"id":"5f5525f4598ee139","repo":"apache/beam","slug":"rename-operation-failed-blobstoragefilesystem","errorCode":null,"errorMessage":"Rename operation failed.","messagePattern":"Rename operation failed\\.","errorType":"exception","errorClass":"BeamIOError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/io/azure/blobstoragefilesystem.py","lineNumber":218,"sourceCode":"    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 = self._blobstorageIO().rename_files(src_dest_pairs)\n    # Retrieve exceptions.\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 self._blobstorageIO().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 in bytes of a file on the FileSystem.\n\n    Args:","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/azure/blobstoragefilesystem.py#L200-L236","documentation":"BlobStorageFileSystem.rename() collects per-pair errors returned by the underlying BlobStorageIO.rename_files() call and raises BeamIOError('Rename operation failed.', exceptions) if any pair failed. The exceptions dict maps each failed (source, destination) pair to its underlying error, so callers can inspect which specific blobs failed to rename.","triggerScenarios":"Calling rename() where at least one (src, dest) pair fails at the Azure level: source blob does not exist, destination container does not exist or is not writable, or the storage account is unreachable/unauthorized. The pre-flight length check passed, so the failure is remote.","commonSituations":"Renaming files discovered earlier that were deleted by another process in the meantime; destination container name typo or missing container; SAS token / credentials lacking write permission on the destination container; transient Azure storage throttling or network errors during bulk renames.","solutions":["Inspect the BeamIOError.exception_details dict to see which (src, dest) pairs failed and why","Verify each source blob exists (fs.exists) and each destination container exists before renaming","Check credentials/SAS permissions allow read on source and write (delete/create) on destination","Retry the failed subset after transient errors, since already-succeeded pairs do not need re-running"],"exampleFix":"// before\nfs.rename(srcs, dests)\n// after\ntry:\n    fs.rename(srcs, dests)\nexcept BeamIOError as e:\n    failed = [pair for pair in e.exception_details]\n    retry_pairs = [(s, d) for (s, d) in failed if fs.exists(s)]\n    if retry_pairs:\n        fs.rename([p[0] for p in retry_pairs], [p[1] for p in retry_pairs])","handlingStrategy":"try-catch","validationCode":"missing = [s for s in source_file_names if not fs.exists(s)]\nif missing:\n    raise FileNotFoundError(f\"sources missing before rename: {missing}\")","typeGuard":null,"tryCatchPattern":"try:\n    fs.rename(srcs, dests)\nexcept BeamIOError as e:\n    failed = e.exception_details  # dict {(src, dest): error}\n    for pair, err in failed.items():\n        logging.error(\"rename failed for %s: %s\", pair, err)\n    # optionally retry the failed subset","preventionTips":["Pre-check that all sources exist and destination containers exist","Grant delete/create permissions on the destination container","Make renames idempotent so a partial-failure retry is safe","Retry failed pairs with backoff for transient Azure errors"],"tags":["python","apache-beam","azure-blob-storage","filesystem-io","bulk-operation"],"backgroundTag":"file-write-failed","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}