I am also experiencing this error. Calling client.beta.threads.runs.create returned a Run object with a run_id of run_EhLpRbLjFpc1x89VC49cVnqq. 35 seconds later, a call to submit_tool_outputs complained that there is no run with that run_id.
This log entry shows the run_id being returned from client.beta.threads.runs.create:
INFO 2023-11-17T05:44:21.818516Z [run] run_EhLpRbLjFpc1x89VC49cVnqq
This log entry shows the exception thrown by client.beta.threads.runs.submit_tool_outputs:
ERROR 2023-11-17T05:44:57.700855Z [error] NotFoundError: Error code: 404 - {'error': {'message': "No run found with id 'run_EhLpRbLjFpc1x89VC49cVnqq'.", 'type': 'invalid_request_error', 'param': None, 'code': None}} at _base_client.py:877
And here is the entire traceback:
Traceback (most recent call last):
File "/workspace/app.py", line 67, in chat
for reply in agent.ask(question):
File "/workspace/agent3.py", line 200, in ask
run = self.client.beta.threads.runs.submit_tool_outputs(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/openai/resources/beta/threads/runs/runs.py", line 309, in submit_tool_outputs
return self._post(
^^^^^^^^^^^
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/openai/_base_client.py", line 1055, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/openai/_base_client.py", line 834, in request
return self._request(
^^^^^^^^^^^^^^
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/openai/_base_client.py", line 865, in _request
return self._retry_request(
^^^^^^^^^^^^^^^^^^^^
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/openai/_base_client.py", line 925, in _retry_request
return self._request(
^^^^^^^^^^^^^^
File "/layers/google.python.pip/pip/lib/python3.11/site-packages/openai/_base_client.py", line 877, in _request
raise self._make_status_error_from_response(err.response) from None
openai.NotFoundError: Error code: 404 - {'error': {'message': "No run found with id 'run_EhLpRbLjFpc1x89VC49cVnqq'.", 'type': 'invalid_request_error', 'param': None, 'code': None}}
Today (about 22 hours later), I tried calling client.beta.threads.runs.retrieve to retrieve the run with this run_id, and the API says it does not exist.
The corresponding thread_id is thread_62zShWsWo6mNxDAtmE5yH2e6, and I did two runs on this thread, run_szGYj6mhPiZqfzcFoTwVlYyn and run_EhLpRbLjFpc1x89VC49cVnqq. But when I call client.beta.threads.run.list for this thread, only the first run is returned.
As far as I’m aware, there is no API call that deletes runs, so this seems like a real bug.
I would love to know anything you figure out about this. Even if it cannot be fixed soon, a partial diagnosis or an estimate of how frequently this can be expected to recur would be very helpful. Thank you!