ValueError: Empty album

Hi,

Every now and then I get the following error and Beets exits during import and I have to start over again. What could cause this problem? I’ve looked on Github but didn’t find a bug that seemed to be connected to this error.

Thanks for any ideas,
Jan

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.7/bin/beet", line 11, in <module>
    load_entry_point('beets==1.4.8', 'console_scripts', 'beet')()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/beets/ui/__init__.py", line 1262, in main
    _raw_main(args)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/beets/ui/__init__.py", line 1249, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/beets/ui/commands.py", line 955, in import_func
    import_files(lib, paths, query)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/beets/ui/commands.py", line 925, in import_files
    session.run()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/beets/importer.py", line 329, in run
    pl.run_parallel(QUEUE_SIZE)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/beets/util/pipeline.py", line 445, in run_parallel
    six.reraise(exc_info[0], exc_info[1], exc_info[2])
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/six.py", line 693, in reraise
    raise value
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/beets/util/pipeline.py", line 358, in run
    self.coro.send(msg)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/beets/util/pipeline.py", line 171, in coro
    task = func(*(args + (task,)))
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/beets/importer.py", line 1543, in manipulate_files
    session=session,
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/beets/importer.py", line 747, in manipulate_files
    plugins.send('import_task_files', session=session, task=self)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/beets/plugins.py", line 476, in send
    result = handler(**arguments)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/beets/plugins.py", line 140, in wrapper
    return func(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/beetsplug/fetchart.py", line 848, in assign_art
    self._set_art(task.album, candidate, not self.src_removed)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/beetsplug/fetchart.py", line 833, in _set_art
    album.set_art(candidate.path, delete)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/beets/library.py", line 1158, in set_art
    artdest = self.art_destination(path)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/beets/library.py", line 1130, in art_destination
    item_dir = item_dir or self.item_dir()
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/beets/library.py", line 1096, in item_dir
    raise ValueError(u'empty album')
ValueError: empty album

It looks like someone else did experience this issue long ago, but we haven’t been able to replicate it.

One option is to disable the fetchart run-on-import option (see auto) and then manually run fetchart afterwards, however that is somewhat of a bandage over the actual problem.

Can you reliably replicate the issue? Is there a specific album it falls over on?

Hi @jackwilsdon Thanks for your swift response!

I’ve not been able to reproduce it yet but the pattern that I might be seeing is the following.

When you’re importing a batch of albums and there are multiple versions of the same album present in the folder your importing it happens that you e.g. process a FLAC album to override a MP3 album. If you then later on process another FLAC version of that same album (let’s say a deluxe) and choose to keep that one and have the other two ‘old’ ones overwritten you can have a situation that if the queue has not yet caught up processing the previous albums. It therefore doesn’t find an album to delete. So if you look at the terminal output below, this might clarify what I mean… So the second is not yet written to disc.

This album is already in the library!
Old: 9 items, MP3, 228kbps, 29:25, 50.3 MiB
Old: 9 items, FLAC, 814kbps, 29:25, 170.8 MiB
New: 14 items, FLAC, 882kbps, 44:26, 280.5 MiB
[S]kip new, Keep both, Remove old, Merge all? R

That would mean that the first (MP3 version) already exists on the hard drive, the second still needs to be written to it because it’s not yet processed (because of the backlog of the queue) and before that has been done Beets gets told that it should delete that still non-existing album because you have another version that supersedes it.
This is the only thing that I’ve been able to think of but I’m not sure if this is the problem.

Best,
Jan