{"record":{"id":"910357f09b62f828","repo":"apache/beam","slug":"error-downloading-the-file-s-locally-to-load-the-feast","errorCode":null,"errorMessage":"error downloading the file %s locally to load the Feast feature store.","messagePattern":"error downloading the file (.+?) locally to load the Feast feature store\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/transforms/enrichment_handlers/feast_feature_store.py","lineNumber":52,"sourceCode":"]\n\nEntityRowFn = Callable[[beam.Row], Mapping[str, Any]]\n\n_LOGGER = logging.getLogger(__name__)\n\nLOCAL_FEATURE_STORE_YAML_FILENAME = 'fs_yaml_file.yaml'\n\n\ndef download_fs_yaml_file(gcs_fs_yaml_file: str):\n  \"\"\"Download the feature store config file for Feast.\"\"\"\n  try:\n    with FileSystems.open(gcs_fs_yaml_file, 'r') as gcs_file:\n      with tempfile.NamedTemporaryFile(suffix=LOCAL_FEATURE_STORE_YAML_FILENAME,\n                                       delete=False) as local_file:\n        local_file.write(gcs_file.read())\n        return Path(local_file.name)\n  except Exception:\n    raise RuntimeError(\n        'error downloading the file %s locally to load the '\n        'Feast feature store.' % gcs_fs_yaml_file)\n\n\ndef _validate_feature_names(feature_names, feature_service_name):\n  \"\"\"Check if one of `feature_names` or `feature_service_name` is provided.\"\"\"\n  if ((not feature_names and not feature_service_name) or\n      bool(feature_names and feature_service_name)):\n    raise ValueError(\n        'Please provide exactly one of a list of feature names to fetch '\n        'from online store (`feature_names`) or a feature service name for '\n        'the Feast online feature store (`feature_service_name`).')\n\n\ndef _validate_feature_store_yaml_path_exists(fs_yaml_file):\n  \"\"\"Check if the feature store yaml path exists.\"\"\"\n  if not FileSystems.exists(fs_yaml_file):\n    raise ValueError(","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/transforms/enrichment_handlers/feast_feature_store.py#L34-L70","documentation":"Raised by `download_fs_yaml_file` when any exception occurs while reading the Feast feature store yaml from its source (typically GCS) and writing it to a local temp file. The original exception is swallowed and replaced by a RuntimeError naming the file path, so the download step failed — network, permissions, or path is the cause.","triggerScenarios":"`__enter__` calls `download_fs_yaml_file(feature_store_yaml_path)`; the path is wrong, the bucket/object does not exist, the caller lacks read permission, or FileSystems.open raises for an unsupported/failed filesystem.","commonSituations":"Typo in gs:// path; missing GCS object after a cleanup job; Dataflow worker service account lacks storage.objects.get; transient network failure during pipeline startup.","solutions":["Verify the yaml path exists and is readable: `apache_beam.io.filesystems.FileSystems.exists(path)`.","Check the worker's service account has read permission on the GCS object/bucket.","Copy the yaml locally and pass a local path for local runs to isolate the issue.","If transient, retry `__enter__`; enable logging to capture the original exception cause."],"exampleFix":"// before\nFeastFeatureStoreEnrichmentHandler(feature_store_yaml_path='gs://my-bucket/fs.yaml', ...)\n// after (verify first)\nassert FileSystems.exists('gs://my-bucket/fs.yaml'), 'yaml missing/unreadable'","handlingStrategy":"try-catch","validationCode":"from apache_beam.io.filesystems import FileSystems\nassert FileSystems.exists(fs_yaml_path), f'{fs_yaml_path} missing or unreadable'","typeGuard":null,"tryCatchPattern":"try:\n    with FileSystems.open(path) as f:\n        data = f.read()\nexcept Exception as e:\n    raise RuntimeError(f'Cannot read {path}: {e!r}') from e","preventionTips":["Check GCS IAM (storage.objects.get) for the worker service account.","Verify the yaml is uploaded before pipeline launch.","Run a local FileSystems.exists check in CI."],"tags":["python","apache-beam","gcs","file-download"],"backgroundTag":"file-read-failed","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"}