{"record":{"id":"d72a4bf6bfa1b692","repo":"apache/beam","slug":"exists-operation-failed","errorCode":null,"errorMessage":"exists() operation failed","messagePattern":"exists\\(\\) operation failed","errorType":"exception","errorClass":"BeamIOError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/io/aws/s3filesystem.py","lineNumber":234,"sourceCode":"    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:\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):","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/aws/s3filesystem.py#L216-L252","documentation":"Raised by S3FileSystem.exists when the underlying S3IO.exists(path) call raises any exception; it is wrapped as BeamIOError with the path as key. This indicates the existence probe itself failed (not that the path is absent).","triggerScenarios":"Calling fs.exists('s3://bucket/key') when boto3 client misconfiguration, invalid credentials, network failure, or an invalid path format raises inside S3IO.exists.","commonSituations":"Expired or missing AWS credentials; wrong region/endpoint config; network outage in CI; malformed path string passed instead of a proper s3:// URL.","solutions":["Inspect the wrapped exception details for the path to see the root cause","Validate the path matches s3://<bucket>/<object> before calling exists","Check AWS credentials/region configuration (env vars, ~/.aws, instance profile)","Retry on transient network errors"],"exampleFix":"// before\nif fs.exists(user_path): ...\n// after\ntry:\n    if fs.exists(user_path): ...\nexcept BeamIOError as e:\n    logging.error('exists check failed: %s', e.exception_details)","handlingStrategy":"try-catch","validationCode":"import re\nif not re.match(r'^s3://[^/]+/.+', path):\n    raise ValueError(f'invalid s3 path: {path}')","typeGuard":null,"tryCatchPattern":"try:\n    exists = fs.exists(path)\nexcept BeamIOError as e:\n    log.error('exists failed for %s: %s', path, e.exception_details)\n    exists = False","preventionTips":["Validate s3:// path format before IO calls","Keep AWS credentials/region configured in the environment","Distinguish 'check failed' from 'returned False' in your code"],"tags":["s3","io","aws","existence-check"],"backgroundTag":"api-request-failed","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"}