OpenAI Chat Model (Invalid value for 'content': expected a string, got null.)

Hey guys,
i am currentlöy building my AI E-Mail Agent using n8n cloud. I am trying to figure out why my OPenAI chat model is not able the work with a normal Chat Trigger input.

Here is the error code:

{ “status”: 400, “headers”: { “access-control-expose-headers”: “X-Request-ID”, “alt-svc”: “h3=":443"; ma=86400”, “cf-cache-status”: “DYNAMIC”, “cf-ray”: “93c9b72adbf19b80-FRA”, “connection”: “keep-alive”, “content-length”: “187”, “content-type”: “application/json”, “date”: “Thu, 08 May 2025 14:41:00 GMT”, “openai-organization”: “____”, “openai-processing-ms”: “30”, “openai-version”: “2020-10-01”, “server”: “cloudflare”, “set-cookie”: “__cf_bm=tMNFRYF1T1yIcHSYor.UVgECVtal1TCtKY.tYkVuxak-1746715260-1.0.1.1-JwElmaMguV.t_vDCEc_dntDCqiIOd_tVuOPz2Y18N.7bhWrKYpQMMOBrnSjBYjRJGzO0h_qkQO3pjMGmHvy9xoCZlCnUmHruauP.E.libt8; path=/; expires=Thu, 08-May-25 15:11:00 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None, _cfuvid=.WcSCx6UY5qaB4lHSYVr5e5HzXmjnyGtACe9Q6lNCOo-1746715260898-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None”, “strict-transport-security”: “max-age=31536000; includeSubDomains; preload”, “x-content-type-options”: “nosniff”, “x-envoy-upstream-service-time”: “33”, “x-ratelimit-limit-requests”: “10000”, “x-ratelimit-limit-tokens”: “200000”, “x-ratelimit-remaining-requests”: “9999”, “x-ratelimit-remaining-tokens”: “199325”, “x-ratelimit-reset-requests”: “8.64s”, “x-ratelimit-reset-tokens”: “202ms”, “x-request-id”: “req_34980dcb4f9ef71e85e8553a62df8074” }, “request_id”: “req_34980dcb4f9ef71e85e8553a62df8074”, “error”: { “message”: “Invalid value for ‘content’: expected a string, got null.”, “type”: “invalid_request_error”, “param”: “messages.[3].content”, “code”: null }, “code”: null, “param”: “messages.[3].content”, “type”: “invalid_request_error”, “attemptNumber”: 1, “retriesLeft”: 2 }

The workflow is screenshoted in the attachment.
Thanks in advance
Lucas

1 Like

Hi @blckalpaca

Can you copy your workflow, and paste it into a code block in this chat? Then we can see what is wrong with your workflow.

Best,

Robert

1 Like

{
“name”: “Email Agent”,
“nodes”: [
{
“parameters”: {
“model”: “gpt-4.1-mini”,
“options”: {
“maxTokens”: 32768
}
},
“id”: “-”,
“name”: “OpenAI Chat Model”,
“type”: “@n8n/n8n-nodes-langchain.lmChatOpenAi”,
“typeVersion”: 1,
“position”: [
340,
660
],
“credentials”: {
“openAiApi”: {
“id”: “-”,
“name”: “OpenAi”
}
}
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “-”,
“name”: “response”,
“value”: “Unable to perform task. Please try again.”,
“type”: “string”
}
]
},
“options”: {}
},
“id”: “-”,
“name”: “Try Again”,
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
1260,
620
]
},
{
“parameters”: {
“assignments”: {
“assignments”: [
{
“id”: “-”,
“name”: “=response”,
“value”: “={{$json.output}}”,
“type”: “string”
}
]
},
“options”: {}
},
“id”: “-”,
“name”: “Success”,
“type”: “n8n-nodes-base.set”,
“typeVersion”: 3.4,
“position”: [
1400,
340
]
},
{
“parameters”: {},
“type”: “@n8n/n8n-nodes-langchain.toolCalculator”,
“typeVersion”: 1,
“position”: [
840,
640
],
“id”: “-”,
“name”: “Calculator”
},
{
“parameters”: {
“sessionIdType”: “customKey”,
“sessionKey”: “={{ $(‘When chat message received’).item.json.sessionId }}”,
“contextWindowLength”: 20
},
“type”: “@n8n/n8n-nodes-langchain.memoryBufferWindow”,
“typeVersion”: 1.3,
“position”: [
500,
660
],
“id”: “-”,
“name”: “Simple Memory”
},
{
“parameters”: {},
“type”: “n8n-nodes-base.errorTrigger”,
“typeVersion”: 1,
“position”: [
-960,
1140
],
“id”: “-”,
“name”: “Error Trigger”
},
{
“parameters”: {
“method”: “POST”,
“url”: “https://blckalpaca.app.n8n.cloud/webhook/monitoring”,
“sendBody”: true,
“specifyBody”: “json”,
“jsonBody”: “={\n "workflowId": "{{$workflow.id}}",\n "nodeName": "{{$error.node.name}}",\n "errorMessage": "{{$error.node.name}}",\n "errorType": "MAIN_WORKFLOW_ERROR",\n "severity": "{{$json["errorSeverity"]}}",\n "timestamp": "{{$now.isoString}}",\n "context": {\n "source": "Main Workflow"\n }\n}\n”,
“options”: {}
},
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
-520,
1020
],
“id”: “-”,
“name”: “Monitoring Agent”
},
{
“parameters”: {
“operation”: “insert”,
“collection”: “error_logs”,
“fields”: “errorCode,errorName,errorMessage,timestamp,operation,collection,documentId,userId,additionalInfo”,
“options”: {
“dateFields”: “={{ $json }}\n”
}
},
“type”: “n8n-nodes-base.mongoDb”,
“typeVersion”: 1.1,
“position”: [
-720,
1020
],
“id”: “-”,
“name”: “Insert Error”,
“credentials”: {
“mongoDb”: {
“id”: “FK96gqZYTxH4RPIw”,
“name”: “MongoDB Database”
}
}
},
{
“parameters”: {
“collection”: “error_logs”,
“options”: {}
},
“type”: “n8n-nodes-base.mongoDb”,
“typeVersion”: 1.1,
“position”: [
-720,
1240
],
“id”: “-”,
“name”: “Find Error”,
“credentials”: {
“mongoDb”: {
“id”: “-”,
“name”: “MongoDB Database”
}
}
},
{
“parameters”: {
“jsCode”: “return [{\n json: {\n memory: items.map(item => {\n const e = item.json;\n return 🛑 ${e.errorType} – ${e.message} (${e.timestamp});\n }).join("\\n\\n") // doppelte Backslashes für Zeilenumbruch\n }\n}];\n”
},
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
-520,
1240
],
“id”: “-”,
“name”: “Error History”
},
{
“parameters”: {
“workflowId”: {
“__rl”: true,
“value”: “6CRi91UvNa3gzwjZ”,
“mode”: “list”,
“cachedResultName”: “IPEC — (Standalone) Audit Logging”
},
“workflowInputs”: {
“mappingMode”: “defineBelow”,
“value”: {},
“matchingColumns”: ,
“schema”: ,
“attemptToConvertTypes”: false,
“convertFieldsToString”: true
},
“options”: {
“waitForSubWorkflow”: true
}
},
“type”: “n8n-nodes-base.executeWorkflow”,
“typeVersion”: 1.2,
“position”: [
1120,
380
],
“id”: “-”,
“name”: “Logging”,
“disabled”: true
},
{
“parameters”: {
“descriptionType”: “manual”,
“toolDescription”: "Greife auf das Postfach zu und lese neue E-Mails aus, um sie für den KI-Agenten zugänglich zu machen. ",
“operation”: “getAll”,
“returnAll”: true,
“filtersUI”: {
“values”: {
“filters”: {
“foldersToInclude”: [
“AAMkADQ1MGU3MzY5LWMwMTEtNDlhZS1iNDFiLTYxOWJjZmVhNzQxMQAuAAAAAAAmAyzhb98KTIGdD0L20oi1AQDvbm7trNfuTKFlghu2xNKoAAAAAAEMAAA=”,
“AAMkADQ1MGU3MzY5LWMwMTEtNDlhZS1iNDFiLTYxOWJjZmVhNzQxMQAuAAAAAAAmAyzhb98KTIGdD0L20oi1AQDvbm7trNfuTKFlghu2xNKoAAAAAAEUAAA=”,
“AAMkADQ1MGU3MzY5LWMwMTEtNDlhZS1iNDFiLTYxOWJjZmVhNzQxMQAuAAAAAAAmAyzhb98KTIGdD0L20oi1AQDvbm7trNfuTKFlghu2xNKoAAAAAAEJAAA=”,
“AAMkADQ1MGU3MzY5LWMwMTEtNDlhZS1iNDFiLTYxOWJjZmVhNzQxMQAuAAAAAAAmAyzhb98KTIGdD0L20oi1AQDvbm7trNfuTKFlghu2xNKoAAAAAAELAAA=”
]
}
}
},
“options”: {}
},
“type”: “n8n-nodes-base.microsoftOutlookTool”,
“typeVersion”: 2,
“position”: [
80,
1300
],
“id”: “-”,
“name”: “Read”,
“webhookId”: “405868b9-1e32-479c-8c52-200f9152d381”,
“credentials”: {
“microsoftOutlookOAuth2Api”: {
“id”: “-”,
“name”: “Microsoft Outlook”
}
}
},
{
“parameters”: {
“descriptionType”: “manual”,
“toolDescription”: “Versieh E-Mails mit passenden Labels oder Tags, um sie übersichtlich zu kategorisieren.\n\n”,
“operation”: “update”,
“messageId”: {
“__rl”: true,
“value”: “={{ $json["emailId"] }}\n”,
“mode”: “id”
},
“updateFields”: {}
},
“type”: “n8n-nodes-base.microsoftOutlookTool”,
“typeVersion”: 2,
“position”: [
240,
1300
],
“id”: “-”,
“name”: “Taggen”,
“webhookId”: “13de0496-9ba5-492a-bb54-aa310864fe7c”,
“credentials”: {
“microsoftOutlookOAuth2Api”: {
“id”: “-”,
“name”: “Microsoft Outlook”
}
}
},
{
“parameters”: {
“descriptionType”: “manual”,
“toolDescription”: “Lösche gezielt ausgewählte E-Mails aus dem Postfach.”,
“operation”: “delete”,
“messageId”: {
“__rl”: true,
“value”: “={{ $json["emailId"] }}\n”,
“mode”: “id”
}
},
“type”: “n8n-nodes-base.microsoftOutlookTool”,
“typeVersion”: 2,
“position”: [
400,
1300
],
“id”: “-”,
“name”: “Delete”,
“webhookId”: “62bc4060-e483-4060-8723-31e11aac52d4”,
“credentials”: {
“microsoftOutlookOAuth2Api”: {
“id”: “-”,
“name”: “Microsoft Outlook”
}
}
},
{
“parameters”: {
“descriptionType”: “manual”,
“toolDescription”: “Verfasse eine kontextgerechte Antwort auf die vorliegende E-Mail und speichere sie im Namen des Nutzers als Entwurf.\n\nErstelle selbstständig einen vollständigen Antwort-Entwurf auf die gegebene E-Mail. Fehlen Betreff oder Inhalt, generiere bis zu drei passende Betreffzeilen und jeweils einen E-Mail-Text, füge automatisch die IPEC-GROUP-Signatur an und verzichte auf Rückfragen.”,
“operation”: “reply”,
“messageId”: {
“__rl”: true,
“value”: “={{ $json["emailId"] }}\n”,
“mode”: “id”
},
“message”: “=”,
“options”: {
“saveAsDraft”: true
}
},
“type”: “n8n-nodes-base.microsoftOutlookTool”,
“typeVersion”: 2,
“position”: [
560,
1300
],
“id”: “-”,
“name”: “Reply”,
“webhookId”: “62bc4060-e483-4060-8723-31e11aac52d4”,
“credentials”: {
“microsoftOutlookOAuth2Api”: {
“id”: “-”,
“name”: “Microsoft Outlook”
}
}
},
{
“parameters”: {
“descriptionType”: “manual”,
“toolDescription”: “Versende neue E-Mails mit den angegebenen Empfängern, Betreff und Inhalt.\n\n{\n "tool": "Send Draft",\n "parameters": {\n "draftId": "{{draftId}}"\n }\n}\n\n\nVerfasse eigenständig neue E-Mail-Entwürfe. Sind Betreff oder Nachrichtentext nicht vorgegeben, biete bis zu drei Betreff- und Text-Varianten an, ergänze automatisch Signatur und ggf. Cc/Bcc-Vorschläge – ganz ohne Nachfragen.\n\nProaktive Entwurfserstellung: Bei E-Mail-Entwurfsanfrage mit wenig/keinem Input: Plausiblen Kontext/Zweck (aus Historie, Empfänger, Annahmen) erschließen. Passenden, generischen Entwurf für Betreff/Text erstellen. Kennzeichnung: ‘Vorschlag Betreff:’, ‘Vorschlag E-Mail-Text:’”,
“toRecipients”: “={{ $fromAI(‘To’, ``, ‘string’) }}”,
“subject”: “={{ $fromAI(‘Subject’, ``, ‘string’) }}”,
“bodyContent”: “={{ $fromAI(‘Message’, ``, ‘string’) }}”,
“additionalFields”: {
“bodyContentType”: “html”
}
},
“type”: “n8n-nodes-base.microsoftOutlookTool”,
“typeVersion”: 2,
“position”: [
720,
1300
],
“id”: “-”,
“name”: “Send”,
“webhookId”: “62bc4060-e483-4060-8723-31e11aac52d4”,
“credentials”: {
“microsoftOutlookOAuth2Api”: {
“id”: “-”,
“name”: “Microsoft Outlook”
}
}
},
{
“parameters”: {
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.chatTrigger”,
“typeVersion”: 1.1,
“position”: [
-960,
440
],
“id”: “-”,
“name”: “When chat message received”,
“webhookId”: “20f05e1a-111a-4226-ab3e-bbe974a329e8”
},
{
“parameters”: {
“descriptionType”: “manual”,
“toolDescription”: “=Erstelle einen Entwurf IMMER mit Betreff & Text ausschließlich in HTML und gebe sie diesen zur Freigabe weiter.\n\n{\n "tool": "Create Draft",\n "parameters": {\n "subject": "{{$node[\"AI Agent\"].json.output.match(/Betreff:\\s*(.+)/)[1]}}",\n "html": "{{$node[\"AI Agent\"].json.output.match(/Nachricht:\\s*([\\s\\S]*)/)[1]}}",\n "toRecipients": [ { "emailAddress": { "address": "[email protected]" } } ]\n }\n}\n”,
“resource”: “draft”,
“subject”: “={{ $(‘Format Output’).item.json.output.subject }}”,
“bodyContent”: “={{ $(‘Format Output’).item.json.output.message }}”,
“additionalFields”: {
“bodyContentType”: “html”
}
},
“type”: “n8n-nodes-base.microsoftOutlookTool”,
“typeVersion”: 2,
“position”: [
860,
1300
],
“id”: “-”,
“name”: “Create Draft”,
“webhookId”: “c551c79c-8e1c-4a68-8dc9-61afcec06c18”,
“credentials”: {
“microsoftOutlookOAuth2Api”: {
“id”: “-”,
“name”: “Microsoft Outlook”
}
}
},
{
“parameters”: {
“descriptionType”: “manual”,
“toolDescription”: “Sendet einen mit "Ja" freigegebenen Entwurf.”,
“resource”: “draft”,
“operation”: “send”,
“draftId”: {
“__rl”: true,
“value”: “=”,
“mode”: “id”
}
},
“type”: “n8n-nodes-base.microsoftOutlookTool”,
“typeVersion”: 2,
“position”: [
1000,
1300
],
“id”: “-”,
“name”: “Send Draft”,
“webhookId”: “63e2c2ee-a960-4a63-8493-6fdb3a7ff93d”,
“credentials”: {
“microsoftOutlookOAuth2Api”: {
“id”: “-”,
“name”: “Microsoft Outlook”
}
}
},
{
“parameters”: {
“descriptionType”: “manual”,
“toolDescription”: “{\n "tool": "Update Draft",\n "parameters": {\n "draftId": "{{draftId}}",\n "subject": "{{BETREFF_AUS_KI}}",\n "html": "{{HTML_TEXT_AUS_KI}}"\n }\n}\n”,
“resource”: “draft”,
“operation”: “update”,
“draftId”: {
“__rl”: true,
“value”: “={{$node["Get Draft"].json["id"]}}”,
“mode”: “id”
},
“updateFields”: {
“bodyContentType”: “html”
}
},
“type”: “n8n-nodes-base.microsoftOutlookTool”,
“typeVersion”: 2,
“position”: [
1160,
1300
],
“id”: “-”,
“name”: “Update Draft”,
“webhookId”: “dbbd3281-a208-4ac0-a9fa-122f4453b882”,
“credentials”: {
“microsoftOutlookOAuth2Api”: {
“id”: “-”,
“name”: “Microsoft Outlook”
}
}
},
{
“parameters”: {
“descriptionType”: “manual”,
“toolDescription”: “Gib sämtliche Drafts inklusive deren draftID als JSON zurück bevor der Draft versendet wird.”,
“operation”: “getAll”,
“returnAll”: true,
“filtersUI”: {
“values”: {
“filters”: {
“foldersToExclude”: [
“AAMkADQ1MGU3MzY5LWMwMTEtNDlhZS1iNDFiLTYxOWJjZmVhNzQxMQAuAAAAAAAmAyzhb98KTIGdD0L20oi1AQDvbm7trNfuTKFlghu2xNKoAAAAAAEUAAA=”,
“AAMkADQ1MGU3MzY5LWMwMTEtNDlhZS1iNDFiLTYxOWJjZmVhNzQxMQAuAAAAAAAmAyzhb98KTIGdD0L20oi1AQDvbm7trNfuTKFlghu2xNKoAAAAAAEVAAA=”,
“AAMkADQ1MGU3MzY5LWMwMTEtNDlhZS1iNDFiLTYxOWJjZmVhNzQxMQAuAAAAAAAmAyzhb98KTIGdD0L20oi1AQDvbm7trNfuTKFlghu2xNKoAAAAAAEKAAA=”,
“AAMkADQ1MGU3MzY5LWMwMTEtNDlhZS1iNDFiLTYxOWJjZmVhNzQxMQAuAAAAAAAmAyzhb98KTIGdD0L20oi1AQDvbm7trNfuTKFlghu2xNKoAAAAAAEMAAA=”,
“AAMkADQ1MGU3MzY5LWMwMTEtNDlhZS1iNDFiLTYxOWJjZmVhNzQxMQAuAAAAAAAmAyzhb98KTIGdD0L20oi1AQDvbm7trNfuTKFlghu2xNKoAAAAAAETAAA=”,
“AAMkADQ1MGU3MzY5LWMwMTEtNDlhZS1iNDFiLTYxOWJjZmVhNzQxMQAuAAAAAAAmAyzhb98KTIGdD0L20oi1AQDvbm7trNfuTKFlghu2xNKoAAAAAAELAAA=”,
“AAMkADQ1MGU3MzY5LWMwMTEtNDlhZS1iNDFiLTYxOWJjZmVhNzQxMQAuAAAAAAAmAyzhb98KTIGdD0L20oi1AQDvbm7trNfuTKFlghu2xNKoAAAAAAEJAAA=”
],
“foldersToInclude”: [
“AAMkADQ1MGU3MzY5LWMwMTEtNDlhZS1iNDFiLTYxOWJjZmVhNzQxMQAuAAAAAAAmAyzhb98KTIGdD0L20oi1AQDvbm7trNfuTKFlghu2xNKoAAAAAAEPAAA=”
]
}
}
},
“options”: {}
},
“type”: “n8n-nodes-base.microsoftOutlookTool”,
“typeVersion”: 2,
“position”: [
1300,
1300
],
“id”: “-”,
“name”: “Get Draft”,
“webhookId”: “eaa42508-38f4-4baf-9aaa-97e0335b396a”,
“credentials”: {
“microsoftOutlookOAuth2Api”: {
“id”: “-”,
“name”: “Microsoft Outlook”
}
}
},
{
“parameters”: {
“sessionIdType”: “customKey”,
“sessionKey”: “={{ $(‘When chat message received’).item.json.sessionId }}”,
“contextWindowLength”: 20
},
“type”: “@n8n/n8n-nodes-langchain.memoryBufferWindow”,
“typeVersion”: 1.3,
“position”: [
-400,
680
],
“id”: “-”,
“name”: “Simple Memory1”
},
{
“parameters”: {
“jsonSchemaExample”: “{\n "subject": "",\n "message": "<ausführliche Nachricht oder Erklärung>"\n}”
},
“type”: “@n8n/n8n-nodes-langchain.outputParserStructured”,
“typeVersion”: 1.2,
“position”: [
-220,
680
],
“id”: “-”,
“name”: “Structured Output Parser”
},
{
“parameters”: {
“promptType”: “define”,
“text”: “={{ $json.chatInput }}”,
“hasOutputParser”: true,
“options”: {
“systemMessage”: “Du bist ein KI-basierter E-Mail-Management-Assistent für IPEC-GROUP, der dafür verantwortlich ist, den Benutzerinput zu formatieren und zu strukturieren, damit der E-Mail-Agent die E-Mails korrekt erstellen und versenden kann.\n\nDeine Aufgaben\nUser Input formatieren:\n- Überprüfe den User Input auf Vollständigkeit und Richtigkeit.\n- Extrahiere die relevanten Informationen, die für den E-Mail-Versand benötigt werden:\n- Empfänger: Wenn keine Empfänger angegeben sind, frage nach den E-Mail-Adressen.\n- Betreff: Falls der Betreff fehlt, generiere einen passenden Betreff basierend auf dem Inhalt.\n- Nachricht: Wenn die Nachricht unklar oder leer ist, fordere den User auf, mehr Informationen bereitzustellen oder generiere eine Standardnachricht basierend auf den vorhandenen Angaben.\n- E-Mail-Format: Stelle sicher, dass die Nachricht im HTML-Format erstellt wird, falls nicht anders angegeben.\n- Signatur: Füge immer die korrekte IPEC-GROUP-Signatur hinzu:\n\nKiki Carnogursky\[email protected]\nRoľnícka 9081/116, 831 07 Vajnory \nSlowakei\n\nVorbereitung der Daten für den E-Mail-Agenten:\n- Verwende das Parser Tool, um den User Input in ein strukturiertes Format zu überführen.\n- Erstelle einen strukturierten Output mit den folgenden Feldern:\nsubject: Der Betreff der E-Mail.\nmessage: Der Nachrichtentext im HTML-Format.\ntoRecipients: Die Empfänger-E-Mail-Adressen.\ndraftId: Die Draft ID\n\nStelle sicher, dass alle Felder vollständig und korrekt ausgefüllt sind, bevor du die Daten an den E-Mail-Agenten weitergibst.\n\nFehlerbehandlung:\n- Falls der User Input unvollständig oder fehlerhaft ist, gib eine klare Rückmeldung und fordere den Benutzer auf, fehlende Informationen zu ergänzen.\n- Falls der Input korrekt formatiert ist, gib alle Daten in einem strukturierten Format zurück, das vom E-Mail-Agenten verarbeitet werden kann.”
}
},
“id”: “-”,
“name”: “Format Output”,
“type”: “@n8n/n8n-nodes-langchain.agent”,
“typeVersion”: 1.6,
“position”: [
-440,
440
],
“retryOnFail”: false,
“maxTries”: 5,
“onError”: “continueRegularOutput”
},
{
“parameters”: {
“promptType”: “define”,
“text”: “={{ $json.output }}”,
“options”: {
“systemMessage”: “=# Rolle & Hauptaufgaben\nDu bist ein professioneller E-Mail-Management-Assistent für IPEC-GROUP. Deine Hauptaufgaben umfassen das Verfassen, Senden, Beantworten, Löschen und Verwalten von E-Mails sowie das Erstellen von Entwürfen. Du erhältst den spezifischen Task (z.B. "send_email", "reply_email") als Input.\n\n# Proaktive Entwurfserstellung & Freigabeprozess\n- Für Reply Email und Send Email erstellst du immer selbstständig Betreff und Nachrichtentext. \n- Jeder E-Mail-Entwurf wird zunächst automatisch als reiner Text per Telegram-Nachricht an den Nutzer (Owner) geschickt. \n- Nur nach ausdrücklicher Freigabe durch eine Antwort „Ja“ sendest du die E-Mail an die echten Empfänger. \n- Sende niemals eigenständig E-Mails ohne diese Freigabe.\n\n# Details zu Reply/Send\n- Reply/Send Email: \n - Generiere eine Variante für Betreff und Nachricht, wenn Betreff/Text fehlen. \n - Füge stets die IPEC-GROUP-Signatur von Kiki Carnogursky an. \n - Keine Rückfragen an den Nutzer.\n\n# Tool Integration\n- Create Draft: \n -Wenn eine E-Mail zu senden ist, erstellst du einen Entwurf (Draft) mit Subject und Message im HTML-Format. Die IPEC-GROUP Signatur wird immer korrekt eingefügt.\n- Entwurf zur Freigabe senden: Der Entwurf wird als reiner Text über Telegram an den Nutzer geschickt. Der Nutzer muss mit „Ja“ bestätigen, um den Entwurf zu senden.\n- Erst nach Freigabe senden: Sobald der Nutzer mit „Ja“ bestätigt, holst du den Entwurf über die gespeicherte Draft-ID und sendest ihn an die angegebenen Empfänger.\n- Update Draft: Falls nötig, kannst du den Entwurf über die Draft-ID aktualisieren, indem du den HTML-Body anpasst.\n\n# E-Mail-Format & Ton\n- Format: Professionelles HTML. \n- Ton: Formell, freundlich, klar, präzise, kundenorientiert. \n- Signatur: Immer korrekt basierend auf Absenderadresse. \n\n# Empfänger-Handling\n- Extrahiere alle „An“, „Cc“ und „Bcc“ aus der Nutzeranfrage. \n- Fehlen Empfängerangaben, liefere den Entwurf per Telegram und bitte um „Ja“, statt automatisch nachzufragen.\n\n# Unternehmens-/Absenderdetails für Signatur\n- Unternehmen: IPEC-GROUP \n- Absender: Kiki Carnogursky \n- E-Mail: [email protected] \n- Adresse: Roľnícka 9081/116, 831 07 Vajnory, Slowakei\n\n# Ablaufbeispiel\n1. Nutzer: send_email an [email protected] – Text: … \n2. Agent erstellt Entwurf (HTML) mit Signatur. \n3. Agent schickt per Telegram: \n4. Nutzer antwortet „Ja“. \n5. Agent sendet die E-Mail.\n\n# Kontext\n- Aktuelles Datum/Uhrzeit: {{ $now }}\n”
}
},
“id”: “-”,
“name”: “AI Agent”,
“type”: “@n8n/n8n-nodes-langchain.agent”,
“typeVersion”: 1.6,
“position”: [
520,
440
],
“retryOnFail”: true,
“maxTries”: 5,
“onError”: “continueErrorOutput”
},
{
“parameters”: {
“model”: {
“__rl”: true,
“mode”: “list”,
“value”: “gpt-4o-mini”
},
“options”: {
“responseFormat”: “json_object”
}
},
“type”: “@n8n/n8n-nodes-langchain.lmChatOpenAi”,
“typeVersion”: 1.2,
“position”: [
-560,
680
],
“id”: “-”,
“name”: “OpenAI Chat Model1”,
“credentials”: {
“openAiApi”: {
“id”: “-”,
“name”: “OpenAi”
}
}
}
],
“pinData”: {},
“connections”: {
“OpenAI Chat Model”: {
“ai_languageModel”: [
[
{
“node”: “AI Agent”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
},
“Calculator”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Simple Memory”: {
“ai_memory”: [
[
{
“node”: “AI Agent”,
“type”: “ai_memory”,
“index”: 0
}
]
]
},
“Try Again”: {
“main”: [

]
},
“Error Trigger”: {
“main”: [
[
{
“node”: “Insert Error”,
“type”: “main”,
“index”: 0
},
{
“node”: “Find Error”,
“type”: “main”,
“index”: 0
}
]
]
},
“Insert Error”: {
“main”: [
[
{
“node”: “Monitoring Agent”,
“type”: “main”,
“index”: 0
}
]
]
},
“Find Error”: {
“main”: [
[
{
“node”: “Error History”,
“type”: “main”,
“index”: 0
}
]
]
},
“Logging”: {
“main”: [
[
{
“node”: “Success”,
“type”: “main”,
“index”: 0
}
]
]
},
“Read”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Taggen”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Delete”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Reply”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Send”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“When chat message received”: {
“main”: [
[
{
“node”: “Format Output”,
“type”: “main”,
“index”: 0
}
]
]
},
“Create Draft”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Send Draft”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Update Draft”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Get Draft”: {
“ai_tool”: [
[
{
“node”: “AI Agent”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Simple Memory1”: {
“ai_memory”: [
[
{
“node”: “Format Output”,
“type”: “ai_memory”,
“index”: 0
}
]
]
},
“Structured Output Parser”: {
“ai_outputParser”: [
[
{
“node”: “Format Output”,
“type”: “ai_outputParser”,
“index”: 0
}
]
]
},
“Format Output”: {
“main”: [
[
{
“node”: “AI Agent”,
“type”: “main”,
“index”: 0
}
]
]
},
“AI Agent”: {
“main”: [
[
{
“node”: “Logging”,
“type”: “main”,
“index”: 0
}
],
[
{
“node”: “Try Again”,
“type”: “main”,
“index”: 0
}
]
]
},
“OpenAI Chat Model1”: {
“ai_languageModel”: [
[
{
“node”: “Format Output”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
}
},
“active”: true,
“settings”: {
“executionOrder”: “v1”,
“callerPolicy”: “workflowsFromSameOwner”
},
“versionId”: “-”,
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “-”
},
“id”: “-”,
“tags”: [
{
“createdAt”: “2025-05-02T17:30:41.619Z”,
“updatedAt”: “2025-05-02T17:30:41.619Z”,
“id”: “-”,
“name”: “e-mail”
}
]
}

Following. I’m having the same problem when I try to connect simple memory.

If I have the openAI Chat Model connected to the AI Agent it works fine. But when i connect the simple memory, the memory works but the Chat model returns the error:

{
“nodes”: [
{
“parameters”: {
“promptType”: “define”,
“text”: “={{ $json.message.text }}”,
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.agent”,
“typeVersion”: 1.9,
“position”: [
-380,
-100
],
“id”: “131042f8-030f-4d4f-beb9-e14b6ba2f210”,
“name”: “AI Agent”
}
],
“connections”: {
“AI Agent”: {
“main”: [

]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “aa95d60ce93447a03a5861f524d89e9ad8567e4274d8648f5860f706cd4e4191”
}
}

Hey @blckalpaca, @Jason_Stapleton

Could you please attach the workflow like this:
n8n attach workflow

1 Like

Might have to borrow that gif :slight_smile: quite handy, maybe n8n can add somehow when creating ticket too :slight_smile: that’d be cool

It’s yours now :saluting_face: use it wisely :smiley:

1 Like

Great idea to share a video on how to attach workflows. I’m going to start doing that as well.

1 Like