High severity HTTP 404 beginner · Fix: 2-5 min

ModelNotFoundError or 404 Model Not Found

google.api_core.exceptions.NotFound: 404 The model `gemini-pro-vision` does not exist

What this error means
The gemini-pro-vision model has been deprecated and removed from the Google Generative AI API; you must migrate to gemini-1.5-flash or gemini-2.0-flash for vision/multimodal tasks.

Stack trace

traceback
google.api_core.exceptions.NotFound: 404 The model `gemini-pro-vision` does not exist or you do not have permission to access it.
Details: {
  'error': {
    'code': 404,
    'message': 'The model `gemini-pro-vision` does not exist or you do not have permission to access it.',
    'errors': [{
      'message': 'The model `gemini-pro-vision` does not exist or you do not have permission to access it.',
      'domain': 'global',
      'reason': 'notFound'
    }],
    'status': 'NOT_FOUND'
  }
}
QUICK FIX
Replace all instances of 'gemini-pro-vision' with 'gemini-1.5-flash' in your code and redeploy: no other changes required.

Why it happens

Google deprecated gemini-pro-vision in favor of newer multimodal models (gemini-1.5-flash, gemini-2.0-flash) that have better vision capabilities, faster inference, and lower costs. The model no longer exists on Google's servers, so any request to it returns a 404 error. This is a hard deprecation: the model is gone, not just marked deprecated.

Detection

Check your code for hardcoded 'gemini-pro-vision' strings and test against the current Google Generative AI SDK (>=0.7.0). Add model existence validation before generation calls to catch deprecated models at startup rather than runtime.

Causes & fixes

1

Using hardcoded model name 'gemini-pro-vision' in genai.GenerativeModel() calls

✓ Fix

Replace 'gemini-pro-vision' with 'gemini-1.5-flash' (recommended) or 'gemini-2.0-flash'. No other code changes needed: both support vision/multimodal inputs identically.

2

Loading model name from old config file or environment variable that still references gemini-pro-vision

✓ Fix

Update your config files (.env, config.yaml, secrets.json) to use gemini-1.5-flash instead. Redeploy or restart the app to load the new config.

3

Using an old version of google-generativeai SDK (pre-0.7.0) that doesn't support newer models

✓ Fix

Upgrade the SDK: `pip install --upgrade google-generativeai` to 0.7.0 or later. Check pip show google-generativeai to verify the version.

4

Dynamically constructing model name from user input or data without validation against supported models

✓ Fix

Add a whitelist of supported models: `SUPPORTED_MODELS = ['gemini-2.0-flash', 'gemini-1.5-pro', 'gemini-1.5-flash']` and validate user input against it before calling GenerativeModel().

Code: broken vs fixed

Broken - triggers the error
python
import os
import google.generativeai as genai

genai.configure(api_key=os.environ['GOOGLE_API_KEY'])

# This model no longer exists — returns 404
model = genai.GenerativeModel('gemini-pro-vision')  # ← BROKEN: deprecated model
response = model.generate_content('What is in this image?', images=[image_bytes])
print(response.text)
Fixed - works correctly
python
import os
import google.generativeai as genai

genai.configure(api_key=os.environ['GOOGLE_API_KEY'])

# Use gemini-1.5-flash instead (supports vision/multimodal)
model = genai.GenerativeModel('gemini-1.5-flash')  # ← FIXED: current multimodal model
response = model.generate_content('What is in this image?', images=[image_bytes])
print(response.text)  # Works identically to old gemini-pro-vision
Changed model name from deprecated 'gemini-pro-vision' to 'gemini-1.5-flash', which is the current Google multimodal model with identical vision capabilities but better performance and lower cost.

Workaround

If you must maintain backward compatibility temporarily, create a compatibility layer that maps the old model name to the new one: `MODEL_MAP = {'gemini-pro-vision': 'gemini-1.5-flash'}` and replace all GenerativeModel(model_name) with GenerativeModel(MODEL_MAP.get(model_name, model_name)). This buys time for a full migration but should be removed within 2 sprints.

Prevention

Store model names in a centralized config file (not hardcoded), implement a model validation function that checks against an official supported list, and monitor Google's model deprecation roadmap. Use the latest google-generativeai SDK and test monthly against new models to catch deprecations early.

Python 3.8+ · google-generativeai >=0.7.0 · tested on 0.7.x
Verified 2026-04 · gemini-1.5-flash, gemini-1.5-pro, gemini-2.0-flash, gemini-pro-vision (deprecated)
Verify ↗

Community Notes

No notes yetBe the first to share a version-specific fix or tip.