Deepseek R1 issue

Hello,

I enabled deepseek r1 model with openAI api key.

It could work when the conversation is short, but when the conversation gets longer, I would always get this response error:

deepseek-reasoner does not support successive user or assistant messages (messages[1] and messages[2] in your input). You should interleave the user/assistant messages in the message sequence.

Looks like cursor somehow split one response into two and broke the conversation ? Why can’t we insert a dummy message between the two?

I’m not sure if this is a bug, or the deepseek doesn’t strictly follow openai’s api.

But I would very appreciate if you can take a deeper look into it.

Thank you!
Jack

1 Like

Got another issue.
Sometimes it raise error:

The first message (except the system message) of deepseek-reasoner must be a user message, but an assistant message detected.

2 Likes

I’m stuck here too. If I don’t add any file, the answer is fine. But if I add add any file, I got the above error message. Please fix it Cursor team.

3 Likes

When leveraging deepseek-reasoner, ensure message roles strictly alternate—user ↔ assistant—as R1 rejects consecutive messages from the same role per design If needed, refactor your system to interleave with placeholders or restructure logic, rather than inserting dummy messages. For resolving errors you must check why DeepSeek not working.