SessionID not in output of chat node

Describe the problem/error/question

The When chat message received node does not output any data including the sessionID. This will create a Simple Memory error because it can’t find the sessionID of the chat.

What is the error message (if any)?

Error in sub-node Simple Memory. The output is:

No session ID found

Expected to find the session ID in an input field called ‘sessionId’ (this is what the chat trigger node outputs). To use something else, change the ‘Session ID’ parameter

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": {
          "responseMode": "lastNode"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.4,
      "position": [
        912,
        -208
      ],
      "id": "eeb54c12-9d3f-43a2-a542-6f402474fe44",
      "name": "When chat message received",
      "webhookId": "a9b33db3-8738-4064-925e-bb850b05a470"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        1120,
        -208
      ],
      "id": "6b88af62-db99-45c8-8f43-33fe51fe1671",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.3,
      "position": [
        992,
        0
      ],
      "id": "8efd71b3-ea5c-489c-b91f-cc336d7cc761",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "oHfLlJ11aAuopWIe",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "mode": "retrieve-as-tool",
        "toolDescription": "Work with your data in Pinecone Vector Store.",
        "pineconeIndex": {
          "__rl": true,
          "value": "wpstechsupport",
          "mode": "list",
          "cachedResultName": "wpstechsupport"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "typeVersion": 1.3,
      "position": [
        1264,
        -80
      ],
      "id": "638cddec-0901-4a08-9a49-37cf31265158",
      "name": "Pinecone Vector Store1",
      "credentials": {
        "pineconeApi": {
          "id": "T7IHnbCawbc8byO6",
          "name": "PineconeApi account"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        1360,
        16
      ],
      "id": "ba1506b8-366a-44d2-a7d1-432003d2724f",
      "name": "Embeddings OpenAI1",
      "credentials": {
        "openAiApi": {
          "id": "oHfLlJ11aAuopWIe",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        1136,
        0
      ],
      "id": "e75002cc-a39b-422c-9b9c-2533c938df2d",
      "name": "Simple Memory"
    }
  ],
  "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
          }
        ]
      ]
    },
    "Pinecone Vector Store1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "aecde0ca4e2ffb74337e9f80db574ef6b3bb1fcc838f0a6e7f60a4b0b47ff45c"
  }
}

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 2.10.4
  • Database (default: SQLite):default
  • n8n EXECUTIONS_PROCESS setting (default: own, main):default
  • Running n8n via (Docker, npm, n8n cloud, desktop app):n8n cloud
  • Operating system: Windows 10 Pro
1 Like

Hi @Justin_Davey I see the issue, in that simple memory node set the sesssion id to connected chat trigger node i mean which is the default value which will come automatically if you remove and re add that node.

Thanks @Anshul_Namdev . Appreciate the quick response! I deleted and re-

added. It worked the first time I ran it but then i got the same error on attempt 2. Here’s the display.

the “works first time, fails on attempt 2” pattern is the key clue — responseMode: lastNode in the Chat Trigger causes the sessionId to not be passed correctly after the first execution in test mode. it’s a known quirk.

in the Chat Trigger node, change Response Mode from lastNode to the default (remove the override entirely, or set it to responseNode only if you have a Respond to Webhook node downstream). for a simple Chat Trigger → AI Agent flow you don’t need lastNode at all.

The ‘works once, fails twice’ behavior is a classic symptom of the ‘responseMode: lastNode’ setting in the Chat Trigger.

In test mode, n8n sometimes struggles to maintain the session context when you’ve told the trigger to wait for the ‘last node’ to finish before acknowledging the webhook. This can cause the ‘sessionId’ to go missing on subsequent runs because the execution context hasn’t fully cleared or re-initialized correctly.

To fix this:

  1. Open your When chat message received (Chat Trigger) node.
  2. Look for the Response Mode parameter.
  3. If it’s set to ‘lastNode’, change it back to the default (or simply remove the override).

For a standard AI Agent flow, you don’t actually need ‘lastNode’. The AI Agent node handles the response back to the chat interface automatically. Using ‘lastNode’ is usually reserved for complex workflows where you have multiple paths and need to manually define which node’s output should be sent back as the final answer.

Thanks! The Respond Mode was set to lastNode. I wasn’t able to default it so I removed the node and re-added. Now it’s defaulted. I attempted again and had the same issue. i refreshed my browser and tried again but still same issue!

1 Like

@Justin_Davey understood, have you tried manually setting the simple memory by define below property and entering this {{ $('When chat message received').item.json.sessionId }} so that you are manually telling it what to actually be look upto this is same as the default but this time you have manually set that as an expression.

One important check: make sure you’re testing through the chat bubble icon on the Chat Trigger node (the built-in test chat), not via the “Test Workflow” button — clicking “Test Workflow” doesn’t fire a real webhook and therefore doesn’t generate a proper sessionId. If you’re already using the chat UI and it still fails, try setting Simple Memory’s Session ID mode to “Custom” and manually entering {{ $('When chat message received').item.json.sessionId }}.