Skip to content

Importsource plugin crash with assert False on imported_items call (again) #6291

@JOJ0

Description

@JOJ0

Hitting the same assert statement as we fixed/worked around recently in the importsource plugin (#6203). Back then it happened when selecting "skip" in the importer, thus the imported_items() list was empty and hitting the assert statement.

This time selecting the "Group albums" option accesses the same thing.

We need to do something about it or (again) work around the issue in the plugin.

Problem

Running this command in verbose (-vv) mode:

$ beet -v import --copy ~/Music/import-devbeets/DirectoryWithSingleFilesAndFolders


Led to this problem:


➜ [A]pply, More candidates, Skip, Use as-is, as Tracks, Group albums,
Enter search, enter Id, aBort, eDit, edit Candidates, plaY? g
Sending event: import_task_choice
Traceback (most recent call last):
  File "/Users/jojo/.pyenv/versions/beets312/bin/beet", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/jojo/git/beets/beets/ui/__init__.py", line 1629, in main
    _raw_main(args)
  File "/Users/jojo/git/beets/beets/ui/__init__.py", line 1608, in _raw_main
    subcommand.func(lib, suboptions, subargs)
  File "/Users/jojo/git/beets/beets/ui/commands/import_/__init__.py", line 131, in import_func
    import_files(lib, byte_paths, query)
  File "/Users/jojo/git/beets/beets/ui/commands/import_/__init__.py", line 75, in import_files
    session.run()
  File "/Users/jojo/git/beets/beets/importer/session.py", line 238, in run
    pl.run_sequential()
  File "/Users/jojo/git/beets/beets/util/pipeline.py", line 415, in run_sequential
    list(self.pull())
  File "/Users/jojo/git/beets/beets/util/pipeline.py", line 492, in pull
    out = coro.send(msg)
          ^^^^^^^^^^^^^^
  File "/Users/jojo/git/beets/beets/util/pipeline.py", line 195, in coro
    task = func(*(args + (task,)))
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jojo/git/beets/beets/importer/stages.py", line 171, in user_query
    plugins.send("import_task_choice", session=session, task=task)
  File "/Users/jojo/git/beets/beets/plugins.py", line 649, in send
    if (r := handler(**arguments)) is not None
             ^^^^^^^^^^^^^^^^^^^^
  File "/Users/jojo/git/beets/beets/plugins.py", line 333, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jojo/git/beets/beetsplug/importsource.py", line 44, in prevent_suggest_removal
    for item in task.imported_items():
                ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jojo/git/beets/beets/importer/tasks.py", line 254, in imported_items
    assert False
           ^^^^^
AssertionError

Setup

  • OS: macOS Tahoe
  • Python version: 3.12
  • beets version: current git + fromfilename-improvements pr + discogs-fixes PR (but also happening with current master, I tested it)
  • Turning off plugins made problem go away (yes/no): deactivating importsource fixes it

My configuration (output of beet config) is:

(paste here)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions