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

Vertex AI

AB9
Bronze 1
Bronze 1

Title: Persistent "404 Publisher Model Not Found" Error in Vertex AI Despite Correct Configuration

Hello,

I am encountering a persistent 404 Publisher Model not found error when trying to access any Gemini model via the Vertex AI Python SDK, and I have exhausted all standard troubleshooting steps. I'm hoping someone can provide insight into what might be causing this account-specific issue.

The Goal:

I am trying to run a simple Python script using the langchain-google-vertexai library to invoke a Gemini model.

The Error:

The script consistently fails with the following error, regardless of which model I try (gemini-1.0-pro, gemini-1.5-pro-latest, gemini-1.5-flash-latest, gemini-1.0-pro-vision):

404 Publisher Model `projects/devcon-prod-env/locations/europe-west1/publishers/google/models/gemini-1.0-pro-vision` was not found or your project does not have access to it.

Troubleshooting Steps Already Taken

I have confirmed the following:

1. Project Configuration is Correct:

  • I created a brand new project (devcon-prod-env) to rule out issues with the old one.

  • The project is correctly set as my default in gcloud:

    $ gcloud config get-value project
    devcon-prod-env

2. Billing is Active:

  • The project is linked to an active and verified billing account. The output of gcloud billing projects describe devcon-prod-env confirms this:

    billingAccountName: billingAccounts/01A9B1-DAEADF-718682
    billingEnabled: true

3. Vertex AI API is Enabled:

  • The aiplatform.googleapis.com service is enabled for the project. The output of gcloud services list --enabled includes:

    NAME                         TITLE
    aiplatform.googleapis.com    Vertex AI API

4. Authentication is Correct:

  • I have logged in and set the quota project for my Application Default Credentials correctly:

    $ gcloud auth application-default set-quota-project devcon-prod-env

5. Code is Correct:

  • I am using a minimal, reproducible script that explicitly sets the model and location.

Code to Reproduce the Error

Here are the exact files to reproduce the issue.

run_agent.py:

import sys
import logging
from langchain_google_vertexai import VertexAI
from langchain_core.prompts import ChatPromptTemplate

logging.basicConfig(level=logging.INFO)

MODEL_NAME = "gemini-1.0-pro-vision" 
LOCATION = "europe-west1"

def run_agent_task(task_prompt: str):
    logging.info(f"Initializing model '{MODEL_NAME}' in location: {LOCATION}...")
    try:
        model = VertexAI(model_name=MODEL_NAME, location=LOCATION)
        
        prompt_template = ChatPromptTemplate.from_messages([("user", task_prompt)])
        chain = prompt_template | model
        
        logging.info("Invoking agent...")
        response = chain.invoke({})
        print("--- AGENT RESPONSE ---")
        print(response.content)

    except Exception as e:
        logging.error(f"An error occurred: {e}")

if __name__ == "__main__":
    run_agent_task("Hello, world.")

My Question

Given that billing is enabled, the API is active, authentication is correct, and the code explicitly calls a known model in a supported region, what could be causing this persistent "404 Publisher Model Not Found" error? Is there a hidden permission or account-level setting that I might be missing?

Thank you for any help you can provide.

0 1 62
1 REPLY 1