{"record":{"id":"5d6dc446adbe6d19","repo":"apache/beam","slug":"unable-to-get-the-file-object-for-path-s","errorCode":null,"errorMessage":"Unable to get the file object for path %s.","messagePattern":"Unable to get the file object for path (.+?)\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/google-cloud-platform-core/src/main/java/org/apache/beam/sdk/extensions/gcp/util/GcsUtilV1.java","lineNumber":415,"sourceCode":"  public StorageObject getObject(GcsPath gcsPath) throws IOException {\n    return getObject(gcsPath, createBackOff(), Sleeper.DEFAULT);\n  }\n\n  @VisibleForTesting\n  StorageObject getObject(GcsPath gcsPath, BackOff backoff, Sleeper sleeper) throws IOException {\n    Storage.Objects.Get getObject =\n        storageClient.objects().get(gcsPath.getBucket(), gcsPath.getObject());\n    try {\n      return ResilientOperation.retry(\n          getObject::execute, backoff, RetryDeterminer.SOCKET_ERRORS, IOException.class, sleeper);\n    } catch (IOException | InterruptedException e) {\n      if (e instanceof InterruptedException) {\n        Thread.currentThread().interrupt();\n      }\n      if (e instanceof IOException && errorExtractor.itemNotFound((IOException) e)) {\n        throw new FileNotFoundException(gcsPath.toString());\n      }\n      throw new IOException(\n          String.format(\"Unable to get the file object for path %s.\", gcsPath), e);\n    }\n  }\n\n  /**\n   * Returns {@link StorageObjectOrIOException StorageObjectOrIOExceptions} for the given {@link\n   * GcsPath GcsPaths}.\n   */\n  public List<StorageObjectOrIOException> getObjects(List<GcsPath> gcsPaths) throws IOException {\n    if (gcsPaths.isEmpty()) {\n      return ImmutableList.of();\n    } else if (gcsPaths.size() == 1) {\n      GcsPath path = gcsPaths.get(0);\n      try {\n        StorageObject object = getObject(path);\n        return ImmutableList.of(StorageObjectOrIOException.create(object));\n      } catch (IOException e) {\n        return ImmutableList.of(StorageObjectOrIOException.create(e));","sourceCodeStart":397,"sourceCodeEnd":433,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/google-cloud-platform-core/src/main/java/org/apache/beam/sdk/extensions/gcp/util/GcsUtilV1.java#L397-L433","documentation":"GcsUtilV1.getObject wraps failures from the GCS Storage.objects.get call into this IOException after retries are exhausted. The library throws it when a GCS object cannot be fetched for the given gs:// path; a genuine 404 is converted to FileNotFoundException first, so this error indicates a non-404 failure (or an interrupted call). The original exception is chained as the cause.","triggerScenarios":"Calling getObject(path) when the GCS API repeatedly fails with retryable errors (socket errors, 5xx), when the caller is interrupted while backing off, when permissions deny object read (403), or when the bucket/object path is malformed.","commonSituations":"Missing or insufficient GCS permissions on the object, transient GCS outages exhausting the backoff, a typo in the bucket name that yields 403 rather than 404, or thread interruption during shutdown.","solutions":["Check the chained cause (e.getCause()) to see the real GCS error code and address it","Verify the service account has storage.objects.get permission (roles/storage.objectViewer)","Confirm the gs:// path and bucket spelling are correct","Retry later if the cause is a transient 5xx/socket error; increase backoff if needed"],"exampleFix":"// before\nStorageObject obj = gcsUtil.getObject(path); // throws IOException with this message\n// after\ntry {\n  StorageObject obj = gcsUtil.getObject(path);\n} catch (FileNotFoundException e) {\n  // object truly missing\n} catch (IOException e) {\n  LOG.error(\"getObject failed for {}: {}\", path, e.getCause(), e);\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"// pre-check\nif (gcsUtil.objectExists(gcsPath)) { /* safe to getObject */ }","typeGuard":"boolean isInterruptedFailure(IOException e) { return e.getCause() instanceof InterruptedException; }","tryCatchPattern":"try {\n  StorageObject obj = gcsUtil.getObject(path);\n} catch (FileNotFoundException e) {\n  // handle missing object\n} catch (IOException e) {\n  LOG.error(\"getObject failed, cause={}\", e.getCause(), e);\n  throw e;\n}","preventionTips":["Grant storage.objectViewer to the caller's service account","Validate gs:// paths before calls","Retry transient failures with exponential backoff","Avoid interrupting threads during GCS calls"],"tags":["gcs","io","network"],"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-15T02:17:10.978Z"}