Assistant API. "message": "No run found with id"

Hello there!

Im using the Assistants API and after I create a Run, i have an API call that checks the status of that run.
The error I get is “message”: “No run found with id”

I have saved the run_id into my database to be sure it generated and also the status, which in the moment of creating it is queued

Anybody else has got this problem?

2 Likes

Hi and welcome to the Developer Forum!

Can you please show your the code making the calls and a log of the output.

2 Likes

Hello there!

I am using Bubble, a no code tool for this.

This is the error I get:
Image-1

And this is the steps I’m doing:
Image-2

Blue: I create a message and add it to the thread that I created in the first step
Green: I create a run
Pink: I save the run_id and status in my database
Orange: I schedule an API call that checks the status of the Run by passing the run_id that I saved previously

And this is the API call that gets the error when I try to get the run status
Image-3

I can get the status of the run and its id when I create the Run.
But when I want to check the status with this API call, it says there isn’t any run with that ID :face_with_raised_eyebrow:

Please let me know if you need more information, thanks for helping! :slight_smile:

I couldn’t post more than one image in a single post because new, so I will post them below separately

Image-2

Image-3 The actual API call getting the status of the Run created and giving back the error

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!

I couldn’t understand what it was, but it started working again when I wrote a new API call and let some days pass

But now I have a problem where after my assistant calls a function and I submit the tool output, there is only one message inside the thread…

And just yesterday it was working already and giving me the answer in JSON format :face_with_raised_eyebrow:

Hi – I am getting this same issue –

The code below returns the message "openai.NotFoundError: Error code: 404 - {‘error’: {‘message’: “No run found with id” – the id provided is correct - -i printed it out after the message is create using client.beta.threads.runs.create(…)

submitted_question = self.client.beta.threads.runs.retrieve(
thread_id=self.active_thread.id,
run_id=submitted_question.id,
)

Is there any solution here?

Thank you.

Okay – my issue was this – and maybe someone else will be able to use this info.

I was not including the correct thread_id with my api requests. For example here:
runid = self.client.beta.threads.runs.retrieve(
thread_id=threadid.id,
run_id=runid.id,
)
I was using the last thread_id instead of the one thread_id with the message run that was made.

Fixed my issue.

Hey there!

I realized I was getting the error “message”: “No run found with id” because my function that was checking the status of the run was running at the same time I was creating the run ID.

Now I made sure I waited for the ID of the Run before triggering my function that check the status of the Run ID.

Hope this is helpful for anyone! If you have any doubts, let me know!