{"record":{"id":"da8abe144c88d49c","repo":"n8n-io/n8n","slug":"a-non-empty-prompt-is-required-da8abe","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/edit.operation.ts","lineNumber":148,"sourceCode":"\t\t\t\thint: 'The name of the output field to put the binary file data in',\n\t\t\t},\n\t\t],\n\t},\n];\n\nconst displayOptions = {\n\tshow: {\n\t\toperation: ['edit'],\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 prompt = this.getNodeParameter('prompt', i, '');\n\tif (typeof prompt === 'string' && !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\tlet model = this.getNodeParameter('modelId', i, '', { extractValue: true }) as string;\n\tif (!model) {\n\t\tmodel = 'models/gemini-2.5-flash-image-preview';\n\t}\n\n\tconst binaryPropertyOutput = this.getNodeParameter('options.binaryPropertyOutput', i, 'edited');\n\tconst outputKey = typeof binaryPropertyOutput === 'string' ? binaryPropertyOutput : 'data';\n\n\t// Collect image binary field names from collection\n\tconst imagesParam = this.getNodeParameter('images', i, {\n\t\tvalues: [{ binaryPropertyName: 'data' }],\n\t});\n\n\tif (!isImagesParameter(imagesParam)) {\n\t\tthrow new Error('Invalid images parameter format');","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/vendors/GoogleGemini/actions/image/edit.operation.ts#L130-L166","documentation":"Thrown by the GoogleGemini image edit operation when the 'prompt' parameter is empty or contains only whitespace. The check validates that prompt is a string and that its trimmed value is non-empty before proceeding to model selection, image upload, and the API call. A non-empty edit instruction is required because the Gemini image editing model needs a text description of the desired edit.","triggerScenarios":"The 'prompt' parameter in the image edit operation is empty, whitespace-only, or an expression that evaluates to an empty string. The check fires at the top of execute() before any image data is read or uploaded.","commonSituations":"Prompt field left blank; expression evaluating the prompt resolves to empty for some input items; user uploaded images but forgot to describe the edit they want; upstream node produced empty data feeding the prompt expression.","solutions":["Enter a non-empty edit instruction in the Prompt field (e.g. 'Remove the background and replace it with a beach scene').","If using an expression, add a fallback (e.g. {{ $json.instruction || 'Edit this image.' }}).","Verify upstream nodes produce non-empty prompt text for all items."],"exampleFix":"// before — prompt is empty\n// prompt: ''\n\n// after — describe the desired edit\n// prompt: 'Add a sunset background behind the subject'","handlingStrategy":"validation","validationCode":"// In an upstream Code node, validate the edit prompt:\nconst prompt = items[0].json.prompt || '';\nif (typeof prompt !== 'string' || !prompt.trim()) {\n  throw new Error('Image edit prompt is required and cannot be empty.');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Write a clear, specific edit instruction in the Prompt field.","Use expression fallbacks to avoid empty prompts (e.g. {{ $json.editInstruction || 'Enhance this image.' }}).","Verify upstream nodes produce non-empty prompt data for all items."],"tags":["validation","prompt","google-gemini","image-edit","empty-input"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}