{"record":{"id":"d6d41b6d23d20d9d","repo":"apache/beam","slug":"size-operation-failed","errorCode":null,"errorMessage":"size() operation failed","messagePattern":"size\\(\\) operation failed","errorType":"exception","errorClass":"BeamIOError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/io/aws/s3filesystem.py","lineNumber":250,"sourceCode":"      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:\n      path: string path in question.\n\n    Returns: int size of path according to the FileSystem.\n\n    Raises:\n      ``BeamIOError``: if path doesn't exist.\n    \"\"\"\n    try:\n      return s3io.S3IO(options=self._options).size(path)\n    except Exception as e:  # pylint: disable=broad-except\n      raise BeamIOError(\"size() operation failed\", {path: e})\n\n  def last_updated(self, path):\n    \"\"\"Get UNIX Epoch time in seconds on the FileSystem.\n\n    Args:\n      path: string path of file.\n\n    Returns: float UNIX Epoch time\n\n    Raises:\n      ``BeamIOError``: if path doesn't exist.\n    \"\"\"\n    try:\n      return s3io.S3IO(options=self._options).last_updated(path)\n    except Exception as e:  # pylint: disable=broad-except\n      raise BeamIOError(\"last_updated operation failed\", {path: e})\n\n  def checksum(self, path):","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/aws/s3filesystem.py#L232-L268","documentation":"Raised by S3FileSystem.size when S3IO.size(path) raises any exception, wrapped as BeamIOError keyed by path. Per the docs it is also the signal that the path does not exist, since size requires an existing object.","triggerScenarios":"Calling fs.size('s3://bucket/key') on a missing object (S3 raises 404/ClientError), invalid path format, or credential/network failure.","commonSituations":"Computing sizes of files deleted by compaction/GC before the size step; key typo or wrong prefix; unauthenticated environments.","solutions":["Call fs.exists(path) (and handle file-not-found) before requesting size","Check the exact path/key spelling including prefix and extension","Validate credentials and region configuration","Catch BeamIOError and treat missing-path cases as expected in pipelines"],"exampleFix":"// before\nsize = fs.size(path)  # 404 for missing object\n// after\ntry:\n    size = fs.size(path)\nexcept BeamIOError as e:\n    if not fs.exists(path):\n        raise FileNotFoundError(path) from e\n    raise","handlingStrategy":"try-catch","validationCode":"if not fs.exists(path):\n    raise FileNotFoundError(path)","typeGuard":null,"tryCatchPattern":"try:\n    size = fs.size(path)\nexcept BeamIOError as e:\n    if not fs.exists(path):\n        raise FileNotFoundError(path) from e\n    raise","preventionTips":["Guard against GC racing size lookups in incremental pipelines","Verify key spelling/prefix before calling","Catch BeamIOError around all size queries"],"tags":["s3","io","aws","file-size"],"backgroundTag":"file-not-found","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}