{"record":{"id":"4c5cb1f0003ceeb8","repo":"n8n-io/n8n","slug":"model-model-is-not-supported-for-image-generati","errorCode":null,"errorMessage":"Model ${model} is not supported for image generation","messagePattern":"Model (.+?) is not supported for image generation","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/vendors/GoogleGemini/actions/image/generate.operation.ts","lineNumber":167,"sourceCode":"\t\t\t\tfileName,\n\t\t\t\tprediction.mimeType,\n\t\t\t);\n\t\t\treturn {\n\t\t\t\tbinary: {\n\t\t\t\t\t[binaryPropertyOutput]: binaryData,\n\t\t\t\t},\n\t\t\t\tjson: {\n\t\t\t\t\t...binaryData,\n\t\t\t\t\tdata: undefined,\n\t\t\t\t},\n\t\t\t\tpairedItem: { item: i },\n\t\t\t};\n\t\t});\n\n\t\treturn await Promise.all(promises);\n\t}\n\n\tthrow new NodeOperationError(\n\t\tthis.getNode(),\n\t\t`Model ${model} is not supported for image generation`,\n\t\t{\n\t\t\tdescription: 'Please check the model ID and try again.',\n\t\t},\n\t);\n}\n","sourceCodeStart":149,"sourceCodeEnd":175,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/vendors/GoogleGemini/actions/image/generate.operation.ts#L149-L175","documentation":"Thrown at the tail of the Google Gemini 'image / generate' operation after the model-id branches for 'gemini' (generateContent) and 'imagen' (predict) have both been skipped. The node only routes image generation to those two model families; any other model id falls through to this terminal throw. The description 'Please check the model ID and try again.' is attached.","triggerScenarios":"User sets Model (modelId, extracted value) to an id whose substring contains neither 'gemini' nor 'imagen' — e.g. a text-only model like 'models/text-embedding-004', a Veo id, or a typo such as 'gemini-3-flash' missing the required token. Also fires when an expression returns an empty/blank model id.","commonSituations":"Selecting a model from the resource list (RLC) that belongs to a different resource (video/text) than 'image'; copying a model id from the Google AI docs that omits the 'gemini'/'imagen' keyword; the v1.2+ default model id being overwritten by an expression; using an older model id after Google renamed it.","solutions":["Open the node, set Model to a Gemini image-capable id (default 'models/gemini-3.1-flash-image-preview' on v1.2+) or an Imagen id such as 'models/imagen-4.0-generate-preview-06-06'.","If the Model field is driven by an expression, verify the resolved value at runtime (Preview execution / executed data) contains 'gemini' or 'imagen'.","If you migrated node versions, confirm node.typeVersion >= 1.2 picks up the new default; otherwise re-pick the model from the list.","For a custom/parameterised model id, rename it so it includes the literal token 'gemini' or 'imagen' that the branch matches on."],"exampleFix":"// before — falls through to the throw\nconst model = 'models/text-bison-001';\n\n// after — uses an imagen model\nconst model = 'models/imagen-4.0-generate-preview-06-06';","handlingStrategy":"validation","validationCode":"const model = String(this.getNodeParameter('modelId', i, '', { extractValue: true }));\nif (!model.includes('gemini') && !model.includes('imagen')) {\n  // surface a friendly error before the API call, or remap to a known id\n  throw new Error(`Image generation requires a 'gemini-*' or 'imagen-*' model, got: ${model}`);\n}","typeGuard":"function isImageModel(model: string): boolean {\n  const m = model.toLowerCase();\n  return m.includes('gemini') || m.includes('imagen');\n}","tryCatchPattern":null,"preventionTips":["Constrain the Model field to a fixed list of image-capable ids via the RLC options list.","Default the field to 'models/gemini-3.1-flash-image-preview' (v1.2+) so it's never blank.","If the model is expression-driven, wrap it: ($json.model ?? '').includes('gemini') || ($json.model ?? '').includes('imagen') ? $json.model : DEFAULT_IMAGE_MODEL."],"tags":["google-gemini","model-id","image-generation","validation","node-operation-error"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}