Runs is complete but I get error 'Can't add messages to [THREAD] while a run [RUN] is active'

Hi all! I saw others post about this topic a few months ago with API version 1.12 but I am having the same issue now with 1.17.

After a run I ask the assistant a question. I get the following error:

Error code: 400 - {'error': {'message': "Can't add messages  to [THREAD] while a run [RUN] is active'

However I have been logging my runs and I see the run has status == completed which means the run should be over…right?

Run(id=‘run_rhrhdyFFPuGUnFIn1XjBG5f0’, assistant_id='XXX, cancelled_at=None, completed_at=None, created_at=1712958866, expires_at=1712959466, failed_at=None, file_ids=, instructions=“XXXX”, last_error=None, metadata={}, model=‘gpt-4-0125-preview’, object=‘thread.run’, required_action=RequiredAction(submit_tool_outputs=RequiredActionSubmitToolOutputs(tool_calls=[RequiredActionFunctionToolCall(id=‘call_blLMHx3wyTk0gGt12fIqmj8T’, function=Function(arguments=XXXX, name=‘XXXX’), type=‘function’)]), type=‘submit_tool_outputs’), started_at=1712958866, status=‘completed’, thread_id=‘thread_1HIlCP0VMFcOvZ2qdR9fWUfA’, tools=[FunctionTool(function=FunctionDefinition(name=‘XXXXX’, description=XXX, parameters=XXXXXX, type=‘function’)], usage=None, temperature=1.0, max_completion_tokens=None, max_prompt_tokens=None, truncation_strategy={‘type’: ‘auto’, ‘last_messages’: None}, incomplete_details=None, response_format=‘auto’, tool_choice=‘auto’)

Maybe this is a separate question but if I see the completed_at value is blank so maybe it’s not actually ‘completed’ yet? Could I assign a timestamp to the completed_at value and then I wonder if that resolve the error? (kind of a brute force hack though)

3 Likes

Were you able to find any information about this? I am having the same issue

The response above shows that the poster overlooked the AI calling tools, needing a tool response sent back.

Are you actually having the same issue?