Skip to content

Cannot read properties of undefined (reading 'message') #23329

@leelisi112

Description

@leelisi112

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).

  1. The issue appears to be caused by a mismatch between:

  2. The output schema of When chat message received

And the input schema expected by Image Prompt Generator

To Reproduce

  1. Run n8n in a Docker self-hosted environment

  2. Create a new workflow

  3. Add a When chat message received trigger

  4. Add an Image Prompt Generator node

  5. Connect the chat trigger directly to the Image Prompt Generator

  6. (Optional) Connect an OpenAI Chat Model and Structured Output Parser as shown in the screenshot

  7. Activate or manually run the workflow

  8. 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')

Image Image

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions