getImagenModel behaviour changed in firebase 13.1.0
In our sandbox runs up to 2026-10-27, claude-sonnet-5-5 and gpt-6.1-sol wrote const { getAI, getImagenModel, GoogleAIBackend } = require("firebase/ai"); for firebase. It fails on 13.1.0 with TypeError (changed between 12.11.0 and 13.1.0). Use const { getAI, getGenerativeModel, GoogleAIBackend } = require("firebase/ai"); instead.
- What to do
- replace the line
- Output
- differs on one example — review first
- Patch
- incomplete: old names remain
- Auto-apply
- not allowed
- Seen in
- 2 models
- Worked / failed
- 2 / 0
- Last verified
- 2026-10-27
What to do
Not for automatic application — after the patch the example still uses getImagenModel, which the verified example does not: the patch covers part of the change. Show this correction to the user as a lead. Review before applying: this fix runs on firebase 13.1.0, but its printed output differs from what the original printed on 12.11.0 (observed stdout of one example) — it may do different work. Replace the old line with the new one; the rest of the code can stay.
Automatic application: not allowed — the fix's output differs from the original's; the patch gives incomplete when applied word for word. Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own. The change itself is described by kind (behaviour changed); the checks are in proof; neither follows from the other.
How to tell this applies to your code
- firebase version 13.1.0 or newer is installed (checked on 13.1.0; changed between 12.11.0 and 13.1.0).
- Your code uses:
getImagenModel - Or it already failed with:
TypeError: getImagenModel is not a function(every correction for this error)
Old and new code
const { getAI, getImagenModel, GoogleAIBackend } = require("firebase/ai");const { getAI, getGenerativeModel, GoogleAIBackend } = require("firebase/ai");
Error on 13.1.0:
TypeError: getImagenModel is not a function
| Script | firebase version | Result |
|---|---|---|
| Code the models wrote | 12.11.0 | works |
| Code the models wrote | 13.1.0 | fails: TypeError |
| Verified example below | 13.1.0 | works |
| Output of the verified example | 13.1.0 | DIFFERS from the original's on 12.11.0 (observed stdout of one example): review before applying |
| Patch applied word for word to the example | 13.1.0 | applied word for word, the patch leaves old names in use: it covers part of the change — after the patch the example still uses getImagenModel, which the verified example does not: the patch covers part of the change |
Verified example for firebase 13.1.0
// Initializes a Firebase app with placeholder config, gets the Firebase AI
// instance, creates a Gemini image model handle, and prints the resolved model name.
// No images are generated and no network requests are made.
const { initializeApp, deleteApp } = require("firebase/app");
const { getAI, getGenerativeModel, GoogleAIBackend } = require("firebase/ai");
async function main() {
const firebaseConfig = {
apiKey: "placeholder-api-key",
authDomain: "placeholder-project.firebaseapp.com",
projectId: "placeholder-project",
storageBucket: "placeholder-project.appspot.com",
messagingSenderId: "000000000000",
appId: "1:000000000000:web:0000000000000000000000",
};
const app = initializeApp(firebaseConfig);
try {
const ai = getAI(app, { backend: new GoogleAIBackend() });
// Creating the model handle is purely local; it does not call the network.
const imagenModel = getGenerativeModel(ai, {
model: "gemini-2.5-flash-image",
});
console.log("Model name:", imagenModel.model);
} finally {
await deleteApp(app);
}
}
main()
.then(() => process.exit(0))
.catch((err) => {
console.error(err);
process.exit(1);
});Source
Imagen methods and types have been removed due to Imagen models being shut down.
Release notes · Seen in: claude-sonnet-5-5, gpt-6.1-sol · First seen 2026-10-27 · Last verified 2026-10-27 · All corrections for firebase
For agents
- This page as JSON:
https://formachines.ai/errata/npm/firebase/0003-getimagenmodel/index.json - Whole database in plain text:
/errata/llms-full.txt - Install the skill:
npx skills add formachines-ai/skills@model-errata(source on GitHub) - Confirm, dispute or add a correction: feedback form and API
- Apply a correction on your own only when its
proof.auto_applyis true (Automatic application is allowed only when proof.equivalent is true and proof.applicability.status is applies; otherwise show the correction to the user as a lead and do not apply it on your own.)