core: Large number of "Uncaught thread exception" errors in log
The problem
My HomeAssistant setup on my Home Assistant Yellow is increasingly working well, and once https://github.com/home-assistant/core/issues/142555#issuecomment-2888562199 is resolved, all the most important things should work well. Great job, all! 👑 Thank you so much! 🙏
One thing that I cannot get to the bottom of is a large (hundreds within just a few hours) number of log ERROR messages about “Uncaught thread exception” in relation to accessing the SQLite database.
Logger: root
Source: /usr/src/homeassistant/homeassistant/bootstrap.py:609
First occurred: 15:13:02 (389 occurrences)
Last logged: 16:55:16
Uncaught thread exception
Traceback (most recent call last):
File "/usr/local/lib/python3.13/threading.py", line 1041, in _bootstrap_inner
self.run()
~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/pyrate_limiter/abstracts/bucket.py", line 196, in run
asyncio.run(self._leak(self.sync_buckets))
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/asyncio/runners.py", line 195, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "/usr/local/lib/python3.13/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/usr/local/lib/python3.13/asyncio/base_events.py", line 719, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/pyrate_limiter/abstracts/bucket.py", line 178, in _leak
leak = bucket.leak(now)
File "/usr/local/lib/python3.13/site-packages/pyrate_limiter/buckets/sqlite_bucket.py", line 120, in leak
self.conn.execute(query)
~~~~~~~~~~~~~~~~~^^^^^^^
sqlite3.OperationalError: database is locked
It looks like the same error, from the same source.
But if you look closely, you’ll see that the count for the number of times this message has occurred for the OLDER entry is HIGHER. So it looks like there are two processes, possibly in a race condition, outblocking each other and throwing an error depending on which one wins. The error messages look identical.
Unfortunately I am not sure which process exactly is behind this. Search in the bug reports and community forum also did not help.
Has anyone seen this before? Any thoughts on what is causing this, or how to find out?
What version of Home Assistant Core has the issue?
core-2025.5.2
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
No response
Link to integration documentation on our website
No response
Diagnostics information
No response
Example YAML snippet
Anything in the logs that might be useful for us?
*** Error 1:
Logger: root
Source: /usr/src/homeassistant/homeassistant/bootstrap.py:609
First occurred: 15:13:02 (375 occurrences)
Last logged: 16:55:17
Uncaught thread exception
Traceback (most recent call last):
File "/usr/local/lib/python3.13/threading.py", line 1041, in _bootstrap_inner
self.run()
~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/pyrate_limiter/abstracts/bucket.py", line 196, in run
asyncio.run(self._leak(self.sync_buckets))
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/asyncio/runners.py", line 195, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "/usr/local/lib/python3.13/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/usr/local/lib/python3.13/asyncio/base_events.py", line 719, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/pyrate_limiter/abstracts/bucket.py", line 178, in _leak
leak = bucket.leak(now)
File "/usr/local/lib/python3.13/site-packages/pyrate_limiter/buckets/sqlite_bucket.py", line 118, in leak
count = self.conn.execute(query).fetchone()[0]
~~~~~~~~~~~~~~~~~^^^^^^^
sqlite3.OperationalError: database is locked
*** Error 2:
Logger: root
Source: /usr/src/homeassistant/homeassistant/bootstrap.py:609
First occurred: 15:13:02 (389 occurrences)
Last logged: 16:55:16
Uncaught thread exception
Traceback (most recent call last):
File "/usr/local/lib/python3.13/threading.py", line 1041, in _bootstrap_inner
self.run()
~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/pyrate_limiter/abstracts/bucket.py", line 196, in run
asyncio.run(self._leak(self.sync_buckets))
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/asyncio/runners.py", line 195, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "/usr/local/lib/python3.13/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/usr/local/lib/python3.13/asyncio/base_events.py", line 719, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/pyrate_limiter/abstracts/bucket.py", line 178, in _leak
leak = bucket.leak(now)
File "/usr/local/lib/python3.13/site-packages/pyrate_limiter/buckets/sqlite_bucket.py", line 120, in leak
self.conn.execute(query)
~~~~~~~~~~~~~~~~~^^^^^^^
sqlite3.OperationalError: database is locked
Additional information
No response
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 2
- Comments: 19
same here
I don’t have that integration, And yet I always make that error. Sometimes more than a thousand times.
No dice. That wasn’t it. The error came back.
Something had to have changed with 2025.5.2 to have caused this. I recently did a bunch of house cleaning and got rid of most of my errors and warnings showing in the logs. After the last core upgrade, this error showed up and I haven’t been able to pinpoint the cause. Pyrate_limiter is running wild.