Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

403 for input file calling batchPredictionJobs for gemini

Following https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/batch-prediction-gemini

I have successfully made simple batch calls for both gcs and bigquery sources. However, for both of those cases, if I try to use fileData to include a gs://path/to/file, the batch is started, but in the results it gives a 403, "Permission denied while accessing input file" and has a broken link (anchor invalid) to a page that doesn't explain fixing the credentials.

The funny thing is that the input file is in the same bucket as the batch request file is. So... it is able to access the bucket because it writes a file to it.

Is there some special format, restriction, etc. that needs to happen for batches to access gcs hosted input files? I made sure the bucket has uniform access, service account has access, it's in us-central1.

Solved Solved
1 2 125
1 ACCEPTED SOLUTION

Thank you for the response.

I feel a bit silly. On the page I linked to, it states:

"Batch prediction only supports public YouTube and Cloud Storage bucket URIs in the fileData field for Gemini."

I saw "public youtube" but missed the "[public] cloud storage bucket" part of that sentence. That was the problem. I used a public bucket for the input file and then it worked.

View solution in original post

2 REPLIES 2

It sounds like you're encountering a permissions issue with your batch job trying to access GCS files, even though it can write to the same bucket. Here are a few things you might want to check to resolve the "Permission denied" issue:-

1. Check IAM Permissions

2. Uniform Bucket-Level Access

3. Bucket Region

4. File Path Syntax

5. Service Account Scopes

6. Test Explicit Permissions

7. Cloud Logging and GCS Audit Logs

Thank you for the response.

I feel a bit silly. On the page I linked to, it states:

"Batch prediction only supports public YouTube and Cloud Storage bucket URIs in the fileData field for Gemini."

I saw "public youtube" but missed the "[public] cloud storage bucket" part of that sentence. That was the problem. I used a public bucket for the input file and then it worked.