Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
AI and LLM integration

Gemini API says the model is not found for gemini-1.5-pro or gemini-1.5-flash

ErrorModel not found when using gemini 1.5

Short answer

Google shut down gemini-1.5-pro, gemini-1.5-flash and gemini-1.5-flash-8b on 29 September 2025, so the API no longer finds them, whatever access you have. Replace the model string with a current model ID from the Gemini models page, and check the deprecation table for the shutdown date of the one you pick.

  • Applies to Gemini API, Node.js 22
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Search the project for every model string. Old IDs hide in config files, env vars and default arguments.

    grep -rn "gemini-" src/ .env* 2>/dev/null
  2. 2Match what you see, then jump to its fix

    1. 1The ID in the error is gemini-1.5-pro, gemini-1.5-flash or gemini-1.5-flash-8bThe Gemini 1.5 models are shut downFix
    2. 2You switched to gemini-2.0-flash or gemini-2.5-flash and the same error returnsThe replacement you chose is shut down tooFix
    3. 3The code worked for months, then a fixed model string started failingA pinned model ID goes stale again laterFix

What does the error look like?

  • Model not found when using gemini 1.5
  • models/gemini-1.5-flash is not found for API version v1beta

Cause 1 of 3

The Gemini 1.5 models are shut down

1Check

The Gemini API changelog lists these three models as shut down on September 29, 2025. Having had access to them before does not change that.

grep -rn "gemini-1.5" src/ .env* 2>/dev/null

2Fix

Move to a current model ID from the models page. At the time of writing it lists gemini-3.8-flash and gemini-3.6-flash as stable. Read the page again when you update.

const model = process.env.GEMINI_MODEL ?? 'gemini-3.8-flash';

3Verify

Send one short request with the new ID.

GEMINI_MODEL=gemini-3.8-flash node ask.mjs "Say hello"

Confirmed by aistudio.google.com

Did this fix it?

Cause 2 of 3

The replacement you chose is shut down too

1Check

The deprecation table gives gemini-2.0-flash and gemini-2.0-flash-lite a shutdown date of June 1, 2026, and gemini-2.5-flash and gemini-2.5-pro a date of December 1, 2026.

grep -rn "gemini-2" src/ .env* 2>/dev/null

2Fix

Pick a model without a near shutdown date. The table names a replacement for each retired ID.

// from the deprecation table:
// gemini-2.0-flash -> gemini-3.6-flash
const model = 'gemini-3.6-flash';

3Verify

Run the request again.

node ask.mjs "Say hello"

Confirmed by aistudio.google.com

Did this fix it?

Cause 3 of 3

A pinned model ID goes stale again later

1Check

The models page describes latest aliases such as gemini-flash-latest, which move to a new version when Google releases one, with a 2-week email notice before the underlying version changes.

grep -rn "latest" src/ .env* 2>/dev/null

2Fix

Use an alias if you want to follow releases, and read the notice emails. Use a pinned ID if you need identical behaviour, and keep a calendar note for its shutdown date.

const model = 'gemini-flash-latest';

3Verify

Run the request and log which model you asked for.

node ask.mjs "Say hello"

Confirmed by aistudio.google.com

Did this fix it?

How do I stop it coming back?

  • Keep the model ID in one environment variable, not in many files.
  • Check the deprecation page before each release, and note the shutdown dates of models you use.
  • Add a startup test that sends one tiny request, so a retired model fails in CI and not for users.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

AI

The model's reply breaks JSON.parse

SyntaxError: Unterminated string in JSON at position 1874

JSON.parse rejects model output for a few repeatable reasons: the JSON sits inside markdown fences or next to a sentence, the reply stopped at the token limit mid-object, a stream was parsed before it ended, or the model refused.

5 causes, each with a fix

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.