Help me out—the AI agent node ran successfully, but the returned content has some issues

Describe the problem/error/question

In N8N, I used the AI Agent to call the DMX API integration model. It showed a successful connection, but when inputting content to the large model, it only returned the error: “Problem in node ‘AI Agent’. Cannot read properties of undefined (reading ‘message’)”. However, connecting to other official large model APIs does not exhibit this issue.

What is the error message (if any)?

[ERROR: Cannot read properties of undefined (reading 'message')]

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
{
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.3,
      "position": [
        208,
        0
      ],
      "id": "87fd1003-f15d-49d1-9eb0-2e0c25d1a2c2",
      "name": "When chat message received",
      "webhookId": "d82a4932-81c4-4249-9ebd-90c746f9233a"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.2,
      "position": [
        432,
        0
      ],
      "id": "e1bf50d2-adaf-45aa-beb3-22eb30bbb874",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "GLM-4.5-Flash",
          "mode": "id"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        272,
        256
      ],
      "id": "e3f137a5-0c4b-497d-b1d5-6485c08a0c45",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "j6OxcEfwAh1fCYpA",
          "name": "DMX API"
        }
      }
    }
  ],
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "08c5d44513b8f7499f7a6fbcb22f9e090fb65ec6a22b42e5ac4fd6d4c4ed02b7"
  }
}

Share the output returned by the last node

Information on your n8n setup

  • **n8n version:**1.110.1
  • Database (default: SQLite):no
  • n8n EXECUTIONS_PROCESS setting (default: own, main):main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): desktop app
  • Operating system:window11

Hi @skyeak,

This issue is most likely coming from the provider, not from n8n.

In many cases, unofficial OpenAI providers experience problems because their OpenAI-compatible backends tend to have a lot of bugs.

Unfortunately, there’s not much you can do on your end.

If you’re not able to use OpenAI directly, try using a well-known provider like OpenRoute, Requesty..etc.

1 Like

Thank you for your response.