So, I stumbled upon the same issue, but on the Ruby client side. In my case, I saw Unknown parameter: 'role'.
even though role was set properly. It was the thread_id that was nil / empty.
The API error is incorrect in this case and should instead say “thread_id is null” or something similar.
I can reproduce it with this
With a wrong thread_id, it shows the correct error.
curl https://api.openai.com/v1/threads/thread_abc123/messages \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "OpenAI-Beta: assistants=v2" \
-d '{
"role": "user",
"content": "How does AI work? Explain it in simple terms."
}'
{
"error": {
"message": "No thread found with id 'thread_abc123'.",
"type": "invalid_request_error",
"param": null,
"code": null
}
}
With a missing thread_id, this is what it shows:
curl https://api.openai.com/v1/threads//messages \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-H "OpenAI-Beta: assistants=v2" \
-d '{
"role": "user",
"content": "How does AI work? Explain it in simple terms."
}'
{
"error": {
"message": "Unknown parameter: 'role'.",
"type": "invalid_request_error",
"param": "role",
"code": "unknown_parameter"
}
}