{"record":{"id":"8d1606ffa1d766a3","repo":"apache/beam","slug":"object-s-not-found","errorCode":null,"errorMessage":"Object %s not found","messagePattern":"Object (.+?) not found","errorType":"exception","errorClass":"NotFound","httpStatus":404,"severity":"error","filePath":"sdks/python/apache_beam/io/gcp/gcsio.py","lineNumber":619,"sourceCode":"    if hasattr(gcs_object, 'size'):\n      file_status['size'] = gcs_object.size\n    return file_status\n\n  def _gcs_object(self, path):\n    \"\"\"Returns a gcs object for the given path\n\n    This method does not perform glob expansion. Hence the given path must be\n    for a single GCS object. The method will make HTTP requests.\n\n    Returns: GCS object.\n    \"\"\"\n    bucket_name, blob_name = parse_gcs_path(path)\n    bucket = self.client.bucket(bucket_name)\n    blob = bucket.get_blob(blob_name, retry=self._storage_client_retry)\n    if blob:\n      return blob\n    else:\n      raise NotFound('Object %s not found', path)\n\n  def list_files(self, path, with_metadata=False):\n    \"\"\"Lists files matching the prefix.\n\n    Args:\n      path: GCS file path pattern in the form gs://<bucket>/[name].\n      with_metadata: Experimental. Specify whether returns file metadata.\n\n    Returns:\n      If ``with_metadata`` is False: generator of tuple(file name, size); if\n      ``with_metadata`` is True: generator of\n      tuple(file name, tuple(size, timestamp)).\n    \"\"\"\n    bucket_name, prefix = parse_gcs_path(path, object_optional=True)\n    file_info = set()\n    counter = 0\n    start_time = time.time()\n    if with_metadata:","sourceCodeStart":601,"sourceCodeEnd":637,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/io/gcp/gcsio.py#L601-L637","documentation":"GcsIO._gcs_object raises google.cloud.exceptions.NotFound ('Object %s not found') when bucket.get_blob returns None, i.e. the object does not exist. This helper backs checksum, size, kms_key, last_updated, and _status, so all of those surface NotFound for missing objects.","triggerScenarios":"Calling any of checksum/size/kms_key/last_updated/_status with a gs:// path whose object doesn't exist, has a typo, or was deleted before the call.","commonSituations":"Stat-ing an output object before the pipeline wrote it; lifecycle rules deleting objects between write and read; case-sensitive object name typos.","solutions":["Check existence first (gcsio.exists(path)) before querying metadata.","Correct the gs:// path, including exact object-name casing.","Catch NotFound and return a sensible default (e.g. None / -1).","Investigate concurrent deletions or retention/lifecycle rules if the object should exist."],"exampleFix":"// before\nsize = gcsio.size(path)\n// after\nsize = gcsio.size(path) if gcsio.exists(path) else None","handlingStrategy":"validation","validationCode":"if not gcsio.exists(path):\n    raise FileNotFoundError(path)","typeGuard":"def is_gcs_path(p):\n    return isinstance(p, str) and re.match(r'^gs://[^/]+/.+$', p) is not None","tryCatchPattern":"from google.cloud.exceptions import NotFound\ntry:\n    size = gcsio.size(path)\nexcept NotFound:\n    size = None","preventionTips":["Call exists() before checksum/size/_status","Match object-name casing exactly","Handle objects deleted by lifecycle rules","Return defaults for missing objects instead of hard-failing"],"tags":["gcs","not-found","metadata"],"backgroundTag":"resource-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"}