Logo

openai

#10068

thread_operation_error

Cannot add messages to a thread while an active run is in progress.

This error has been identified and solved.

Reason

The error "Can't add messages to thread_JS11XQsRG0YCGFpW7ylpG2yM while a run run_yQrPxI86HgmUs0Q9b1XFx23L is active" with a 400 status code in the OpenAI API typically indicates that you are attempting to add messages to a conversation thread while an existing API request (or "run") is still active and has not yet completed.

This error occurs because the OpenAI API does not allow you to add new messages to a thread until the current run associated with that thread has finished. This is a restriction to maintain the integrity and sequence of the conversation flow.

Solution

To fix the error "Can't add messages to thread_JS11XQsRG0YCGFpW7ylpG2yM while a run run_yQrPxI86HgmUs0Q9b1XFx23L is active," you need to ensure that you are not attempting to add new messages to the thread until the current run has completed.

  • Wait for the current run to complete before adding new messages.

  • Check the status of the run periodically and only proceed with adding messages once the status is "completed".

  • Consider implementing a queue to handle messages that need to be added while a run is active, and process them once the run is completed.

  • Ensure your loop or asynchronous function correctly handles the waiting period for the run to finish before attempting to add new messages.

Original Error Message

Raw

Cannot add messages to a thread while an active run is in progress.

Original Error Message

Raw

Cannot add messages to a thread while an active run is in progress.

© 2024 Portkey, Inc. All rights reserved

HIPAA

COMPLIANT

GDPR

Transform Your AI app prototypes to be production-ready

Talk to us →