n8n-io/n8n · error · Error
Invalid images parameter format
Error message
Invalid images parameter format
What it means
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).
Source
Thrown at packages/@n8n/nodes-langchain/nodes/vendors/GoogleGemini/actions/image/edit.operation.ts:166
throw new NodeOperationError(this.getNode(), 'A non-empty prompt is required.', {
itemIndex: i,
});
}
let model = this.getNodeParameter('modelId', i, '', { extractValue: true }) as string;
if (!model) {
model = 'models/gemini-2.5-flash-image-preview';
}
const binaryPropertyOutput = this.getNodeParameter('options.binaryPropertyOutput', i, 'edited');
const outputKey = typeof binaryPropertyOutput === 'string' ? binaryPropertyOutput : 'data';
// Collect image binary field names from collection
const imagesParam = this.getNodeParameter('images', i, {
values: [{ binaryPropertyName: 'data' }],
});
if (!isImagesParameter(imagesParam)) {
throw new Error('Invalid images parameter format');
}
const imagesUi = imagesParam.values ?? [];
const imageFieldNames = imagesUi
.map((v) => v.binaryPropertyName)
.filter((n): n is string => Boolean(n));
// Upload all images and gather fileData parts
const fileParts = [] as Array<{ fileData: { fileUri: string; mimeType: string } }>;
for (const fieldName of imageFieldNames) {
const bin = this.helpers.assertBinaryData(i, fieldName);
const buf = await this.helpers.getBinaryDataBuffer(i, fieldName);
const uploaded = await uploadFile.call(this, buf, bin.mimeType);
fileParts.push({ fileData: { fileUri: uploaded.fileUri, mimeType: uploaded.mimeType } });
}
const generationConfig = {
responseModalities: ['IMAGE'],View on GitHub (pinned to 5ac6606e81)
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.
Example fix
// before — malformed images parameter in workflow JSON
// "images": { "values": "data" } // values should be an array
// after — correct structure
// "images": { "values": [{ "binaryPropertyName": "data" }] } Defensive patterns
Strategy: type-guard
Validate before calling
// Validate images parameter structure before the API call:
function isValidImagesParam(param: unknown): boolean {
if (typeof param !== 'object' || param === null) return false;
const obj = param as Record<string, unknown>;
if (!('values' in obj)) return true;
if (!Array.isArray(obj.values)) return false;
return obj.values.every((item: unknown) => {
if (typeof item !== 'object' || item === null) return false;
const itemObj = item as Record<string, unknown>;
if (!('binaryPropertyName' in itemObj)) return true;
return typeof itemObj.binaryPropertyName === 'string' || itemObj.binaryPropertyName === undefined;
});
} Type guard
function isImagesParameter(param: unknown): param is { values?: Array<{ binaryPropertyName?: string }> } {
if (typeof param !== 'object' || param === null) return false;
const obj = param as Record<string, unknown>;
if ('values' in obj && !Array.isArray(obj.values)) return false;
if (Array.isArray(obj.values)) {
return obj.values.every((item: unknown) =>
typeof item === 'object' && item !== null &&
(!('binaryPropertyName' in (item as object)) ||
typeof (item as Record<string, unknown>).binaryPropertyName === 'string' ||
(item as Record<string, unknown>).binaryPropertyName === undefined)
);
}
return true;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid response format from Gemini API
- A non-empty prompt is required.
- Expected Supabase credentials host to be a string
- No image data returned from Gemini API
- A non-empty prompt is required.
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/3807a85def90981d.
Report an issue: GitHub.