Skip to content

Error 400: Cannot read properties of undefined (reading 'message') #1930

@Fotonnn

Description

@Fotonnn

Welcome!

  • Yes, I have searched for similar issues on GitHub and found none.

What did you do?

I deployed Evolution API v2.3.2 in a Docker Swarm environment and tried to send text messages through the endpoint:
POST https://<server>/message/sendText/<instanceId>
The setup uses the official WhatsApp Business API + Evolution API to also register messages in Chatwoot.

What did you expect?

The API should either:

Successfully deliver the message and return a 201 Created response, or

If the upstream Graph API rejects the request, return a structured JSON error (with error.message) instead of crashing.

What did you observe instead of what you expected?

Intermittently the API returns a 400 Bad Request with the following body:

{
  "status": 400,
  "error": "Bad Request",
  "response": {
    "message": [
      "TypeError: Cannot read properties of undefined (reading 'message')"
    ]
  }
}

The log in the container shows:

TypeError: Cannot read properties of undefined (reading 'message')
    at Ts.sendMessageWithTyping (/evolution/dist/main.js:218:416)
    at Ts.textMessage (/evolution/dist/main.js:218:1363)
    at ds.sendText (/evolution/dist/main.js:2:23273)
    at qi.dataValidate (/evolution/dist/main.js:275:76061)

This happens intermittently (e.g. 3:11 works, 3:12 fails, 3:13 works again).

Screenshots/Videos

No response

Which version of the API are you using?

"version": "2.3.2"
(Is not working to anothers version too!)

What is your environment?

Docker

Other environment specifications

No response

If applicable, paste the log output

[Evolution API] [Prod] v2.3.2 157 - Tue Sep 09 2025 14:56:54 ERROR [ChannelStartupService] [object]

TypeError: Cannot read properties of undefined (reading 'message')

at Ts.sendMessageWithTyping (/evolution/dist/main.js:218:416)

at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

at async Ts.textMessage (/evolution/dist/main.js:218:1363)

at async ds.sendText (/evolution/dist/main.js:2:23273)

at async qi.dataValidate (/evolution/dist/main.js:275:76061)

at async /evolution/dist/main.js:275:149841

Additional Notes

On v2.3.2 (with v23.0), the error occurs intermittently.

Looks like the code assumes err.response.data.error.message always exists, but in some Graph API failures it does not, causing the TypeError.

Suggest adding a null-check before accessing error.message in sendMessageWithTyping.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions