-
Notifications
You must be signed in to change notification settings - Fork 52.2k
Description
Bug Description
When running a chat-based workflow in n8n (Docker self-hosted), the workflow fails during execution at the Image Prompt Generator node.
The node throws a runtime error:
Cannot read properties of undefined (reading 'message')
The error occurs even though the workflow is correctly triggered by “When chat message received” and receives a valid user message. Execution stops immediately at the Image Prompt Generator node, preventing all downstream nodes from running.
This suggests that the Image Prompt Generator node assumes the presence of a message field in its input, but the actual input provided by the chat trigger does not include this field (or uses a different schema).
-
The issue appears to be caused by a mismatch between:
-
The output schema of When chat message received
And the input schema expected by Image Prompt Generator
To Reproduce
-
Run n8n in a Docker self-hosted environment
-
Create a new workflow
-
Add a When chat message received trigger
-
Add an Image Prompt Generator node
-
Connect the chat trigger directly to the Image Prompt Generator
-
(Optional) Connect an OpenAI Chat Model and Structured Output Parser as shown in the screenshot
-
Activate or manually run the workflow
-
Send any chat message (for example: Generate a banana image)
The workflow fails at the Image Prompt Generator node with the error:
Cannot read properties of undefined (reading 'message')
Expected behavior
The Image Prompt Generator node should correctly receive the chat message from the When chat message received trigger and generate a valid image prompt.
If the required input field (such as message) is missing or renamed, the node should:
-
Either map the correct field automatically
-
Or fail gracefully with a clear validation error indicating which input field is missing
Under no circumstances should the workflow crash due to an unhandled undefined property access.
Debug Info
Additional notes
The workflow is triggered correctly by the chat trigger.
The error occurs consistently and is fully reproducible.
Restarting the container does not resolve the issue.
Other workflows not using Image Prompt Generator continue to function normally.
Operating System
mac
n8n Version
2.0.2
Node.js Version
22.21.0
Database
SQLite (default)
Execution mode
main (default)
Hosting
self hosted