Vertex AI GenerateContent fails with 404 Publisher Model not found

Vertex AI GenerateContent fails with 404 Publisher Model not found despite Owner role, correct config, and ADC.

I am trying to use the Vertex AI Python client library (google-cloud-aiplatform) to call Gemini models from a Python script running on my local machine (macOS). I am using Application Default Credentials (ADC) set up via gcloud auth application-default login on a standalone personal Google Cloud project (not part of an Organization, not using VPC Service Controls).

My vertexai.init() call succeeds, and instantiating GenerativeModel() also succeeds. However, when I call the model.generate_content() method, it fails consistently.

Error Message:

google.api_core.exceptions.NotFound: 404 Publisher Model `projects/blog-writer-agent/locations/us-central1/publishers/google/models/gemini-1.0-pro` was not found or your project does not have access to it. Please ensure you are using a valid model version. For more information, see: https://cloud.google.com/vertex-ai/generative-ai/docs/learn/model-versions

(Traceback points to the prediction_service/client.py making the API call)

Minimal Reproducible Code (test_vertexai.py):

import vertexai
from vertexai.generative_models import GenerativeModel
import traceback

# --- Configuration ---
PROJECT_ID = "blog-writer-agent"
LOCATION = "us-central1"
MODEL_NAME = "gemini-1.0-pro" # Stable model tested

print(f"Attempting to initialize Vertex AI for project='{PROJECT_ID}', location='{LOCATION}'...")

try:
    # Initialize Vertex AI
    vertexai.init(project=PROJECT_ID, location=LOCATION)
    print("Vertex AI initialized successfully.")

    print(f"Attempting to load model: '{MODEL_NAME}'...")
    # Load the model
    model = GenerativeModel(MODEL_NAME)
    print("Model loaded successfully.")

    print("Attempting to generate content...")
    # Generate content - THIS IS WHERE THE ERROR OCCURS
    response = model.generate_content("Why is the sky blue?")
    print("Content generation call successful.")

    print("\n--- Response ---")
    print(response.text)
    print("--- End Response ---")

except Exception as e:
    print("\n--- An Error Occurred ---")
    print(f"Error: {e}")
    traceback.print_exc()
    print("--- End Error ---")

Troubleshooting Steps Performed:

  • IAM: Confirmed my user account (PII Removed by Staff) has the Owner role on the blog-writer-agent project.

  • API Status: Verified “Vertex AI API” is Enabled in the Cloud Console for the project. Also tried disabling and re-enabling it, waiting 10+ minutes. Checked Console metrics, confirming 100% error rate for PredictionService.GenerateContent.

  • Credentials: Successfully created and refreshed Application Default Credentials using gcloud auth application-default login. Also tried renaming the credentials file and re-running the command.

  • Billing: Confirmed a Billing Account is linked to the project and is Active with no warnings or alerts. Corrected billing address details in payment settings.

  • Code Config: Verified PROJECT_ID and LOCATION (us-central1) are correct in the code and used in vertexai.init().

  • Model: Tested with stable model gemini-1.0-pro (also tried gemini-1.5-flash previously with same error).

  • Environment: Confirmed project is personal (no Org policies) and not using VPC Service Controls.

  • Cloud Status: Checked Google Cloud Status Dashboard; no active incidents seem related to Vertex AI predictions in us-central1.

Despite all these checks, the generate_content call consistently fails with the 404 Not Found error.

What other potential causes could lead to this specific error under these circumstances, or what further diagnostic steps can I take?

Hi @peplupo ,
The 404 error usually means your project does not have access to the Gemini model — even if the code and setup look correct.

Here’s what to check:

  • Go to the Vertex AI Model Garden and verify that Gemini is available in your project.

  • Make sure you requested access to Gemini models — some models require filling out an access form or enabling a specific preview.

  • Check that your region (us-central1) supports the exact model/version.

  • Run gcloud auth list to confirm the active account matches the project owner.

If access is missing, you’ll need to request it via your Google Cloud console or support.

Hi @peplupo
Did this fix it? I’m facing the same issues.

@a_aleinikov I checked the model accessibility to the account (visible on Model Garden) and the region, but I’m still seeing this error.

The sample you used here is using model “gemini-1.0-pro”. This model has been discontinued so that may be the reason you’re getting a 404.

Note that Gemini 2.0 and above is only supported by Google Gen AI SDK (https://cloud.google.com/vertex-ai/generative-ai/docs/sdks/overview)

Vertex AI SDK you used above is still able to connect to Gemini 2.0 but won’t work with Gemini new features.

1 Like

Check if the model is available in the regional endpoint you’re trying to access it from

https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations

some models are deprecated and no longer supported. Some models are only available in certain regions

Thanks for the hint!
I had similar issues running the RAG Engine.
Here I had to check that the RAG Engine has the same location as the model, which is super tricky to get right.
The RAG Engine is limited (for europe) to:
Europe

  • europe-west3 (Frankfurt)
  • europe-west4 (Netherlands)

So for gemini-2.5-flash-lite the only option is europe-west4 as the model is not hosted in europe-west3.