When using postgres to persist conversations, deleting a conversation successfully removes that conversation in the database however it throws an error post deletion instead of success response.
2025-06-27 18:47:34,353 [ols.app.endpoints.conversations:conversations.py:153] INFO: Deleting chat history for user: user:development/guest with conversation_id: 168f4f83-578a-45fb-910c-3898af477530
2025-06-27 18:47:34,354 [ols.src.cache.postgres_cache:postgres_cache.py:136] INFO: Connection to storage is ok
2025-06-27 18:47:34,356 [ols.src.cache.postgres_cache:postgres_cache.py:250] ERROR: PostgresCache.delete: no results to fetch
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/app-root/ols/src/cache/postgres_cache.py", line 248, in delete
return PostgresCache._delete(cursor, user_id, conversation_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app-root/ols/src/cache/postgres_cache.py", line 376, in _delete
return cursor.fetchone() is not None
^^^^^^^^^^^^^^^^^
psycopg2.ProgrammingError: no results to fetch
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 403, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in __call__
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
await super().__call__(scope, receive, send)
File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 112, in __call__
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 187, in __call__
raise exc
After deleting the conversation, the endpoint should not throw any error instead it should return successful response.
Bug Description
When using postgres to persist conversations, deleting a conversation successfully removes that conversation in the database however it throws an error post deletion instead of success response.
To Reproduce
Steps to reproduce the behavior:
/conversations/<conversation_id>endpointExpected behavior
After deleting the conversation, the endpoint should not throw any error instead it should return successful response.
Screenshots or output