{"record":{"id":"3807a85def90981d","repo":"n8n-io/n8n","slug":"invalid-images-parameter-format","errorCode":null,"errorMessage":"Invalid images parameter format","messagePattern":"Invalid images parameter format","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/vendors/GoogleGemini/actions/image/edit.operation.ts","lineNumber":166,"sourceCode":"\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');\n\t}\n\n\tconst imagesUi = imagesParam.values ?? [];\n\tconst imageFieldNames = imagesUi\n\t\t.map((v) => v.binaryPropertyName)\n\t\t.filter((n): n is string => Boolean(n));\n\n\t// Upload all images and gather fileData parts\n\tconst fileParts = [] as Array<{ fileData: { fileUri: string; mimeType: string } }>;\n\tfor (const fieldName of imageFieldNames) {\n\t\tconst bin = this.helpers.assertBinaryData(i, fieldName);\n\t\tconst buf = await this.helpers.getBinaryDataBuffer(i, fieldName);\n\t\tconst uploaded = await uploadFile.call(this, buf, bin.mimeType);\n\t\tfileParts.push({ fileData: { fileUri: uploaded.fileUri, mimeType: uploaded.mimeType } });\n\t}\n\n\tconst generationConfig = {\n\t\tresponseModalities: ['IMAGE'],","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/vendors/GoogleGemini/actions/image/edit.operation.ts#L148-L184","documentation":"Thrown by the GoogleGemini image edit operation when the 'images' parameter fails the isImagesParameter type guard. This guard validates that the parameter is an object with an optional 'values' array where each item has an optional 'binaryPropertyName' string. Note: this throws a plain Error, not a NodeOperationError, which means it bypasses n8n's standard error reporting enrichment (no itemIndex, no node context).","triggerScenarios":"The 'images' fixedCollection parameter has an unexpected shape — e.g. 'values' exists but is not an array, or an item in values is not an object, or a binaryPropertyName value is present but is not a string. This is rare in normal UI usage since the parameter editor enforces structure, but can occur with programmatic workflow generation, corrupted workflow JSON, or version migration issues.","commonSituations":"Workflow JSON manually edited or generated programmatically with incorrect images parameter structure; node version migration that changed the parameter schema without migrating old workflows; corrupted workflow import.","solutions":["Open the node in the editor and re-add the images in the Images fixedCollection — the UI will enforce the correct structure.","Inspect the workflow JSON for the 'images' parameter and ensure it matches { values: [{ binaryPropertyName: 'data' }] }.","Delete and recreate the node if the parameter structure cannot be corrected through the UI."],"exampleFix":"// before — malformed images parameter in workflow JSON\n// \"images\": { \"values\": \"data\" }  // values should be an array\n\n// after — correct structure\n// \"images\": { \"values\": [{ \"binaryPropertyName\": \"data\" }] }","handlingStrategy":"type-guard","validationCode":"// Validate images parameter structure before the API call:\nfunction isValidImagesParam(param: unknown): boolean {\n  if (typeof param !== 'object' || param === null) return false;\n  const obj = param as Record<string, unknown>;\n  if (!('values' in obj)) return true;\n  if (!Array.isArray(obj.values)) return false;\n  return obj.values.every((item: unknown) => {\n    if (typeof item !== 'object' || item === null) return false;\n    const itemObj = item as Record<string, unknown>;\n    if (!('binaryPropertyName' in itemObj)) return true;\n    return typeof itemObj.binaryPropertyName === 'string' || itemObj.binaryPropertyName === undefined;\n  });\n}","typeGuard":"function isImagesParameter(param: unknown): param is { values?: Array<{ binaryPropertyName?: string }> } {\n  if (typeof param !== 'object' || param === null) return false;\n  const obj = param as Record<string, unknown>;\n  if ('values' in obj && !Array.isArray(obj.values)) return false;\n  if (Array.isArray(obj.values)) {\n    return obj.values.every((item: unknown) =>\n      typeof item === 'object' && item !== null &&\n      (!('binaryPropertyName' in (item as object)) ||\n       typeof (item as Record<string, unknown>).binaryPropertyName === 'string' ||\n       (item as Record<string, unknown>).binaryPropertyName === undefined)\n    );\n  }\n  return true;\n}","tryCatchPattern":null,"preventionTips":["Use the node's UI to configure the Images fixedCollection rather than editing workflow JSON directly.","When generating workflows programmatically, follow the exact parameter schema: { values: [{ binaryPropertyName: 'data' }] }.","After importing workflows, verify the images parameter structure is valid in the node UI before executing."],"tags":["validation","type-guard","google-gemini","image-edit","parameter-structure"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}