OpenAI "Message a model" assitant error - Invalid ThreadId

I started getting error in OpenAI message a model node. I had been using my assistant for a long time and now I am getting invalid threadId error. Is there any one else getting the same error? I was wondering if this was a temporary issue.

What is the error message (if any)?

ERROR: 400 Invalid ‘thread_id’: ‘undefined’. Expected an ID that begins with ‘thread’

Please share your workflow

Information on your n8n setup

  • n8n version:. 1.102.0
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system: MacOS 15.5 (24F74)

same here.
a quick fix is to change the memory in the node to “use thread ID” instead of “use memory connector”

Hi @victor.arocha @Ceylan_Kesenek! Welcome to community!
When you are using GPT Assistant, you need to define the thread ID for the conversation (see below)

OR

You can customize your memory tool to match with Assistant needs (In your case, the assistant need thread_id that starts with thread)
You can change it to thread_{{ $json.sessionId }} since you’re using chat trigger.

If it helps, kindly mark my message as solution, thanks!

1 Like

hi, are there any other solutions?, I did not succeed on your advice.


1 Like

you can replace sessionId with the user Id. that you can get it from Telegram Trigger

And how to create this session ID? Or where to find it

Hi! Im having the same problem, tried your solution but nothig… I’m using redis chat memory on a message assistant node…
Its funny that using an AI Agent it works, but when i plug it directly to a message assistant node it doesn’t work. Any ideas?


I have the same problem. I haven’t found any solution.

It’s really weird tho.
Have you ever been looking into the redis db?

I am using mongodb connector.

Hi, I had the same problem and I did something like this. instead of using “use memory connector” l chose “use thread ID”, you can send “undefined” the “thread_id” field but, Open AI will going to create a thread for each time, for that reason l send a custom “thread_id”, this “theard_id” is generated by OpenAI, for it is necesary send post request method “https://api.openai.com/v1/threads”.

if you need to save the data in your own database, will be necesary add extra node and save the most important information there, but if it doesn’t necesary, just sends the thread_id and OpenAI will be in charge of data.

PD: excuse my english, l’m from latam jejeje

hi, I’m facing exactly same situation as you. Did you manage to resolve this?

EDIT: This is my workaround. I used the simple memory to store the thread ID.

same problem :frowning:

can you share your workflow

but then you get no memory for chats

I figured it out BUT how do you add the thread ID

the idea is to store the mapping between your chat session_id and openai’s thread_id into the simple memory. For my case I’m using Slack as my chat interface so I customized the thread_id from Slack’s format, but I’m sure you’ll get the point.

You need to change your n8n to a version that doesn’t have this issue. This worked for me, at least until n8n fixes it.

Same problem here, after try some all sugested solutions do no have success.

Same issue here. Downgrading to an earlier version fixed it for me. I’ll wait for a fix.