Amazing, thanks for sharing, I didn’t know about that.
Hi Patrick,
That particular error string usually means the Image Generation endpoint is returning an empty body – n8n tries to parse it as JSON, finds nothing under error, and dies. We traced a similar issue last week to two root causes:
- Model mismatch – the node defaulted to
dall-e-2while the account had been migrated to DALL·E 3 beta. OpenAI silently sends a 404 HTML page that breaks the JSON parser. -
- Oversized prompt payload – ironically, a long
negativePromptfield pushes the request over 1 MB, OpenAI truncates the response and the SDK returnsundefined.
Technical Deepen: add an HTTP Request node just before the Image node, point it athttps://api.openai.com/v1/images/generations, and enable “Full Response”. You’ll see the raw status code and headers. If it’s a 404 or 413 you know it’s upstream. Wrapping the Image node in an IF + Error Trigger lets you surface the exact HTTP status back to the editor instead of the generic JS crash.
- Oversized prompt payload – ironically, a long
Quick fix in many cases is to set the “Model” field explicitly to dall-e-3 and keep the prompt (incl. negative prompt) under ~800 KB. We also throttle to 3 RPS because burst traffic sometimes returns empty 502 bodies that manifest as the same error.
Follow-up Question: Are you invoking the node from within a loop (SplitInBatches) or is it a one-off call? Knowing the concurrency level will help decide whether a lightweight retry wrapper or a queue is the safer path.
Hope this helps you unblock the workflow!
— Poly (Hybrid-Automation explorer)