apache/hadoop · error · IOException

Error accessing %s

Error message

Error accessing %s

What it means

getBlob(resourceId) performs storage.get(BlobId.of(bucket, object)) with projected fields; any StorageException is wrapped as IOException("Error accessing " + resourceId) with the cause. Unlike getBucket(), there is no NOT_FOUND special case here — a missing object returns a null Blob, so this exception always indicates a genuine failure of objects.get (auth, permissions, network, malformed id).

Source

Thrown at hadoop-cloud-storage-project/hadoop-gcp/src/main/java/org/apache/hadoop/fs/gs/GoogleCloudStorage.java:274

  /**
   * Gets the object with the given resourceId.
   *
   * @param resourceId identifies a StorageObject
   * @return the object with the given name or null if object not found
   * @throws IOException if the object exists but cannot be accessed
   */
  @Nullable
  Blob getBlob(StorageResourceId resourceId) throws IOException {
    checkArgument(resourceId.isStorageObject(), "Expected full StorageObject id, got %s",
        resourceId);
    String bucketName = resourceId.getBucketName();
    String objectName = resourceId.getObjectName();
    Blob blob;
    try {
      blob = storage.get(BlobId.of(bucketName, objectName),
          Storage.BlobGetOption.fields(BLOB_FIELDS.toArray(new Storage.BlobField[0])));
    } catch (StorageException e) {
      throw new IOException("Error accessing " + resourceId, e);
    }
    return blob;
  }

  private static GoogleCloudStorageItemInfo createItemInfoForBucket(StorageResourceId resourceId,
      Bucket bucket) {
    checkArgument(resourceId != null, "resourceId must not be null");
    checkArgument(bucket != null, "bucket must not be null");
    checkArgument(resourceId.isBucket(), "resourceId must be a Bucket. resourceId: %s", resourceId);
    checkArgument(resourceId.getBucketName().equals(bucket.getName()),
        "resourceId.getBucketName() must equal bucket.getName(): '%s' vs '%s'",
        resourceId.getBucketName(), bucket.getName());

    return GoogleCloudStorageItemInfo.createBucket(resourceId,
        bucket.asBucketInfo().getCreateTimeOffsetDateTime().toInstant().toEpochMilli(),
        bucket.asBucketInfo().getUpdateTimeOffsetDateTime().toInstant().toEpochMilli(),
        bucket.getLocation(),
        bucket.getStorageClass() == null ? null : bucket.getStorageClass().name());

View on GitHub (pinned to 2add963021)

Solutions

  1. Read the nested StorageException reason — 403 means grant storage.objects.get on the bucket, network reasons mean retry/failover
  2. Verify access with gsutil cat gs://bucket/object as the same service account
  3. Validate the StorageResourceId (bucket and object name non-empty, no stray leading slash) before calling
  4. Retry transient causes; the connector does not retry this path for you
Defensive patterns

Strategy: try-catch

Validate before calling

// Validate the resource id before fetching
checkArgument(resourceId.isStorageObject(), "expected object id");
checkArgument(!isNullOrEmpty(resourceId.getBucketName())
    && !isNullOrEmpty(resourceId.getObjectName()), "bucket/object required");
Blob b = gcs.getBlob(resourceId);

Try / catch

try {
  Blob blob = gcs.getBlob(resourceId);
  if (blob == null) { /* not found */ }
} catch (IOException e) {
  if (e.getMessage().startsWith("Error accessing ") && e.getCause() instanceof StorageException) {
    StorageException se = (StorageException) e.getCause();
    // 403 -> permissions; 5xx -> retry
  }
  throw e;
}

Prevention

When it happens

Trigger: getItemInfo / getFileStatus / open() on an object while the credentials lack storage.objects.get on that bucket; objects.get failing due to API or network errors; resource ids constructed with invalid characters that break the request.

Common situations: Service account can list but not read objects (objectViewer missing); reading objects in a bucket with uniform bucket-level access where the grant was only per-object; transient GCS API errors; keyfile mismatch between projects.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/0ef6b1f76019fa70. Report an issue: GitHub.