{"record":{"id":"7fdc77c657e6afd2","repo":"n8n-io/n8n","slug":"a-non-empty-prompt-is-required-7fdc77","errorCode":null,"errorMessage":"A non-empty prompt is required.","messagePattern":"A non-empty prompt is required\\.","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/vendors/GoogleGemini/actions/image/generate.operation.ts","lineNumber":81,"sourceCode":"\t\t\t},\n\t\t],\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['generate'],\n\t\tresource: ['image'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nexport async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {\n\tconst model = this.getNodeParameter('modelId', i, '', { extractValue: true }) as string;\n\tconst prompt = this.getNodeParameter('prompt', i, '') as string;\n\tif (!prompt.trim()) {\n\t\tthrow new NodeOperationError(this.getNode(), 'A non-empty prompt is required.', {\n\t\t\titemIndex: i,\n\t\t});\n\t}\n\tconst binaryPropertyOutput = this.getNodeParameter(\n\t\t'options.binaryPropertyOutput',\n\t\ti,\n\t\t'data',\n\t) as string;\n\n\tif (model.includes('gemini')) {\n\t\tconst generationConfig = {\n\t\t\tresponseModalities: [Modality.IMAGE, Modality.TEXT],\n\t\t};\n\t\tconst body: GenerateContentRequest = {\n\t\t\tcontents: [\n\t\t\t\t{\n\t\t\t\t\trole: 'user',\n\t\t\t\t\tparts: [{ text: prompt }],","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/vendors/GoogleGemini/actions/image/generate.operation.ts#L63-L99","documentation":"Thrown by the GoogleGemini image generate operation when the 'prompt' parameter is empty or whitespace-only after trimming. This is a pre-flight validation check at the top of execute() before model selection and API call. The Gemini image generation model requires a text prompt describing the desired image.","triggerScenarios":"The 'prompt' parameter is empty, contains only whitespace, or an expression evaluating to it produces an empty string. The check fires before the model is read and before any API call, so no API quota is consumed.","commonSituations":"Prompt field left blank in the node UI; expression in the prompt field evaluates to empty for some input items; upstream node produced empty data; user expected a default prompt but none is built into the node.","solutions":["Enter a non-empty text description of the desired image in the Prompt field (e.g. 'A serene mountain landscape at sunset with a lake in the foreground').","If using an expression, add a fallback value (e.g. {{ $json.description || 'A colorful abstract painting' }}).","Verify upstream nodes produce non-empty prompt text for all items."],"exampleFix":"// before — prompt is empty\n// prompt: ''\n\n// after — provide a descriptive prompt\n// prompt: 'A futuristic city skyline at dusk with flying vehicles'","handlingStrategy":"validation","validationCode":"// In an upstream Code node, validate the generation prompt:\nconst prompt = items[0].json.prompt || '';\nif (!prompt.trim()) {\n  throw new Error('Image generation prompt is required and cannot be empty.');\n}\n// or provide a default:\nitems[0].json.prompt = prompt.trim() || 'A beautiful abstract artwork.';","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Write a descriptive image prompt in the Prompt field.","Use expression fallbacks for the prompt (e.g. {{ $json.description || 'A serene landscape painting' }}).","Ensure upstream nodes produce non-empty prompt text for all input items."],"tags":["validation","prompt","google-gemini","image-generation","empty-input"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}