Hello everyone,
I’ve run into a strange issue with n8n. A few days ago, my workflow was working perfectly, but now some nodes have stopped working, and I keep getting the following error:
bash
КопироватьРедактировать
Cannot read properties of undefined (reading 'message')
Issue description:
- I’m using Gmail Trigger to fetch new emails.
- Then, an “Assess if message needs a reply” node determines if the email requires a response.
- After that, the email goes through a Text Classifier to categorize it.
- Suddenly, this Text Classifier node fails to read “message”, even though the email data is coming through.
- Gmail Trigger is correctly fetching the email data (including
textAsHtml
andtext
). - I’ve tested with different OpenAI models (GPT-4o, GPT-4-mini, GPT-3.5-turbo), but the issue persists.
- No settings were changed since the last time this workflow worked fine.
What I’ve tried:
- Restarting n8n – didn’t help.
- Updating n8n to the latest version – issue persists.
- Creating a new workflow with the same nodes – still getting the same error.
- Trying different logic for processing data (JSON Parser, Edit Fields) – no improvement.
- Checking input schema –
text
andtextAsHtml
are both available.
Question:
What might have changed that is causing Text Classifier to not recognize “message”, even though the data is clearly present?
Is there a workaround or fix for this issue?
I’d really appreciate any help!
(Attaching screenshots of my workflow and the error)
{
“nodes”: [
{
“parameters”: {
“pollTimes”: {
“item”: [
{
“mode”: “everyMinute”
}
]
},
“simple”: false,
“filters”: {
“labelIds”: [
“UNREAD”
]
},
“options”: {}
},
“id”: “6c3938cf-3d67-4f9c-a49b-9bd2a2cd5d3f”,
“name”: “Gmail Trigger1”,
“type”: “n8n-nodes-base.gmailTrigger”,
“position”: [
1660,
-260
],
“typeVersion”: 1,
“credentials”: {
“gmailOAuth2”: {
“id”: “AN8RYJKoDMuTEMwl”,
“name”: “Gmail account”
}
}
},
{
“parameters”: {
“jsonSchema”: “{\n "type": "object",\n "properties": {\n "needsReply": {\n "type": "boolean"\n }\n },\n "required": ["needsReply"]\n}\n”
},
“id”: “29979680-ddea-44ff-a462-204568a53aa6”,
“name”: “JSON Parser1”,
“type”: “@n8n/n8n-nodes-langchain.outputParserStructured”,
“position”: [
1960,
0
],
“typeVersion”: 1
},
{
“parameters”: {
“model”: “=gpt-3.5-turbo”,
“options”: {
“responseFormat”: “json_object”,
“temperature”: 0
}
},
“id”: “f293c7a3-97fd-482e-b5ef-65045355d866”,
“name”: “OpenAI Chat1”,
“type”: “@n8n/n8n-nodes-langchain.lmChatOpenAi”,
“position”: [
1820,
0
],
“typeVersion”: 1,
“credentials”: {
“openAiApi”: {
“id”: “hvRVeOzyvPXf9b9g”,
“name”: “OpenAi account”
}
}
},
{
“parameters”: {
“prompt”: "=Subject: {{ $json.subject }}\nMessage:\n{{ $json.textAsHtml }} ",
“messages”: {
“messageValues”: [
{
“message”: “Analyze the subject and message of the email. Determine if the message requires a response. The email may be in Finnish, Estonian, or English. Return your response in this JSON format”
}
]
}
},
“id”: “8c34b2e1-406a-49ac-8ca9-053cd6d70467”,
“name”: “Assess if message needs a reply1”,
“type”: “@n8n/n8n-nodes-langchain.chainLlm”,
“position”: [
1880,
-220
],
“typeVersion”: 1.3,
“retryOnFail”: true,
“maxTries”: 2
},
{
“parameters”: {
“inputText”: “=Subject: {{ $(‘Gmail Trigger1’).item.json.subject }}\nMessage: {{ $(‘Gmail Trigger1’).item.json.textAsHtml }}”,
“categories”: {
“categories”: [
{
“category”: “Kiireelliset ja tärkeät viestit”,
“description”: “Sähköpostit, joissa pyydetään hintatietoja tai kustannusarvioita. Avainsanat: "hinta", "tarjous", "arvio", "kustannus"ellinen", "ASAP", "prioriteetti", "määräaika".”
},
{
“category”: “Hinnatiedustelut”,
“description”: “Sähköpostit, jotka vaativat välitöntä huomiota tai toimintaa. Näihin liittyy usein määräaikoja tai kriittisiä asioita. Avainsanat: "kiireellinen", "ASAP", "prioriteetti", "määräaika".”
},
{
“category”: “Käynnissä olevat projektit”,
“description”: “Sähköpostit, jotka liittyvät käynnissä oleviin projekteihin, kuten päivityksiin tai ongelmiin. Avainsanat: "edistyminen", "käynnissä", "päivitys".”
},
{
“category”: “Laskut ja kirjanpito”,
“description”: “Sähköpostit, jotka liittyvät laskuihin, maksuihin tai kirjanpitoon. Avainsanat: "lasku", "maksu", "kirjanpito", "tilit".”
},
{
“category”: “Tukipyynnöt”,
“description”: “Sähköpostit, joissa pyydetään teknistä tai asiakastukea. Avainsanat: "apua", "tuki", "ongelma", "kysymys".”
},
{
“category”: “Tapaamispyynnöt”,
“description”: “Sähköpostit, joissa pyydetään tai ehdotetaan tapaamista. Avainsanat: "tapaaminen", "ajanvaraus", "aikataulu".”
},
{
“category”: “Mainonta ja promootiot”,
“description”: “Sähköpostit, jotka sisältävät mainontaa tai kampanjoita. Avainsanat: "tarjous", "mainos", "alennus", "kampanja".”
}
]
},
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.textClassifier”,
“typeVersion”: 1,
“position”: [
2220,
-100
],
“id”: “f882cbc8-f5f9-4e97-b73e-e8ac0e0527cd”,
“name”: “Text Classifier1”
},
{
“parameters”: {
“model”: {
“__rl”: true,
“mode”: “list”,
“value”: “gpt-4o-mini”
},
“options”: {
“responseFormat”: “json_object”
}
},
“type”: “@n8n/n8n-nodes-langchain.lmChatOpenAi”,
“typeVersion”: 1.2,
“position”: [
2120,
140
],
“id”: “b195b085-eee4-4c2b-9b98-b350e741d320”,
“name”: “OpenAI Chat Model8”,
“credentials”: {
“openAiApi”: {
“id”: “hvRVeOzyvPXf9b9g”,
“name”: “OpenAi account”
}
}
}
],
“connections”: {
“Gmail Trigger1”: {
“main”: [
[
{
“node”: “Assess if message needs a reply1”,
“type”: “main”,
“index”: 0
}
]
]
},
“JSON Parser1”: {
“ai_outputParser”: [
[
{
“node”: “Assess if message needs a reply1”,
“type”: “ai_outputParser”,
“index”: 0
}
]
]
},
“OpenAI Chat1”: {
“ai_languageModel”: [
[
{
“node”: “Assess if message needs a reply1”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
},
“Assess if message needs a reply1”: {
“main”: [
[
{
“node”: “Text Classifier1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Text Classifier1”: {
“main”: [
,
,
,
,
,
,
]
},
“OpenAI Chat Model8”: {
“ai_languageModel”: [
[
{
“node”: “Text Classifier1”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“templateId”: “2271”,
“templateCredsSetupCompleted”: true,
“instanceId”: “d234f853a733592736c227a006a21099a0271cb4d2dc30289099364861006e1c”
}
}