{"record":{"id":"0ef6b1f76019fa70","repo":"apache/hadoop","slug":"error-accessing-s","errorCode":null,"errorMessage":"Error accessing %s","messagePattern":"Error accessing (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-cloud-storage-project/hadoop-gcp/src/main/java/org/apache/hadoop/fs/gs/GoogleCloudStorage.java","lineNumber":274,"sourceCode":"  /**\n   * Gets the object with the given resourceId.\n   *\n   * @param resourceId identifies a StorageObject\n   * @return the object with the given name or null if object not found\n   * @throws IOException if the object exists but cannot be accessed\n   */\n  @Nullable\n  Blob getBlob(StorageResourceId resourceId) throws IOException {\n    checkArgument(resourceId.isStorageObject(), \"Expected full StorageObject id, got %s\",\n        resourceId);\n    String bucketName = resourceId.getBucketName();\n    String objectName = resourceId.getObjectName();\n    Blob blob;\n    try {\n      blob = storage.get(BlobId.of(bucketName, objectName),\n          Storage.BlobGetOption.fields(BLOB_FIELDS.toArray(new Storage.BlobField[0])));\n    } catch (StorageException e) {\n      throw new IOException(\"Error accessing \" + resourceId, e);\n    }\n    return blob;\n  }\n\n  private static GoogleCloudStorageItemInfo createItemInfoForBucket(StorageResourceId resourceId,\n      Bucket bucket) {\n    checkArgument(resourceId != null, \"resourceId must not be null\");\n    checkArgument(bucket != null, \"bucket must not be null\");\n    checkArgument(resourceId.isBucket(), \"resourceId must be a Bucket. resourceId: %s\", resourceId);\n    checkArgument(resourceId.getBucketName().equals(bucket.getName()),\n        \"resourceId.getBucketName() must equal bucket.getName(): '%s' vs '%s'\",\n        resourceId.getBucketName(), bucket.getName());\n\n    return GoogleCloudStorageItemInfo.createBucket(resourceId,\n        bucket.asBucketInfo().getCreateTimeOffsetDateTime().toInstant().toEpochMilli(),\n        bucket.asBucketInfo().getUpdateTimeOffsetDateTime().toInstant().toEpochMilli(),\n        bucket.getLocation(),\n        bucket.getStorageClass() == null ? null : bucket.getStorageClass().name());","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-cloud-storage-project/hadoop-gcp/src/main/java/org/apache/hadoop/fs/gs/GoogleCloudStorage.java#L256-L292","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the nested StorageException reason — 403 means grant storage.objects.get on the bucket, network reasons mean retry/failover","Verify access with gsutil cat gs://bucket/object as the same service account","Validate the StorageResourceId (bucket and object name non-empty, no stray leading slash) before calling","Retry transient causes; the connector does not retry this path for you"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Validate the resource id before fetching\ncheckArgument(resourceId.isStorageObject(), \"expected object id\");\ncheckArgument(!isNullOrEmpty(resourceId.getBucketName())\n    && !isNullOrEmpty(resourceId.getObjectName()), \"bucket/object required\");\nBlob b = gcs.getBlob(resourceId);","typeGuard":null,"tryCatchPattern":"try {\n  Blob blob = gcs.getBlob(resourceId);\n  if (blob == null) { /* not found */ }\n} catch (IOException e) {\n  if (e.getMessage().startsWith(\"Error accessing \") && e.getCause() instanceof StorageException) {\n    StorageException se = (StorageException) e.getCause();\n    // 403 -> permissions; 5xx -> retry\n  }\n  throw e;\n}","preventionTips":["Distinguish null-blob (absent) from thrown IOException (genuine failure) in callers","Ensure storage.objects.get is granted for the bucket","Sanitize object names (no leading slash, no invalid characters)"],"tags":["gcs","hadoop-gcp","blob-metadata","permissions","storageexception"],"backgroundTag":"blob-fetch-failed","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}