Beets constantly crashing | ValueError: empty album for album id 142

My beets is constantly crashing on import on many different albums of mine, its becoming an issue and is preventing me from using Beets properly.

My issue is in detail here:
https://www.reddit.com/r/musichoarder/comments/jb8sjy/beets_constantly_erroring_and_crashing_what_is/

and here is latest error:

I found a similar topic in Beets Discourse here, I disabled fetart and it did not solve the issue:

Here is my config:

This is really frustrating and im sure its something small… but this is continuously plaguing me.

If anyone can help I’d appreciate it!

I manually delete the empty albums in the database by first searching for them like this:
select count(*) from albums left join items on items.album_id = albums.id WHERE items.id IS NULL

Then there is always 1 which is empty after this error.

Then i delete them by running this command:
delete from albums where id IN (select albums.id from albums left join items on items.album_id = albums.id WHERE items.id IS NULL)


After that, I run it again, and the error shows up again… Quite draining to be honest

1 Like

As someone on Reddit stated, your database seems to be damaged. Unless you have an idea how that happened, what exactly is wrong about the database and how to undo it, I can’t think of a reliable way to restore the database to a consistent state. If you can, restore from a working backup or rebuild the database, as also suggested on Reddit. Manually modifying some of the Sqlite tables is probably a good way to bring the database into an inconsistent state in the first place.

Here are some things to try:

  • disable plugins (not just fetchart or any other single plugin), in particular the non-official plugins. The traceback posted on reddit probably is an issue with a plugin (can’t tell which, though, see the next point.) That is not necessarily the underlying problem, though.
  • run beets in verbose mode (-v), see whether it gives any further clues.
  • try to reproduce on a new database: If you manage to do so, we’d have an actual starting point to debug the issue

Next time, please don’t scatter the information about your problem across three external websites, and don’t screenshot error messages but copy the text.