Skip to content

Conversation

@JOJ0
Copy link
Member

@JOJ0 JOJ0 commented Jan 31, 2026

Description

Fixes #6291

I think it does not hurt if the imported_items() method returned an empty list instead of an throwing an exception if there is nothing in it!

To Do

  • Documentation.
  • Changelog.
  • Tests.

@github-actions
Copy link

Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry.

@JOJ0 JOJ0 marked this pull request as ready for review January 31, 2026 08:34
@JOJ0 JOJ0 requested a review from a team as a code owner January 31, 2026 08:34
Copilot AI review requested due to automatic review settings January 31, 2026 08:34
@github-actions
Copy link

Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a crash in the ImportTask.imported_items() method that occurred when the method was called with certain choice flags (like Action.ALBUMS, Action.TRACKS, or Action.SKIP). The issue was triggered by the importsource plugin during the import_task_choice event, which called imported_items() before items were actually imported. The fix replaces an assert False statement with a return of an empty list, which is the appropriate behavior for these edge cases.

Changes:

  • Replaces assert False with return [] in the else branch of ImportTask.imported_items() method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Jan 31, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 68.95%. Comparing base (f9cf157) to head (d2600c3).
⚠️ Report is 2 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
beets/importer/tasks.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6326   +/-   ##
=======================================
  Coverage   68.95%   68.95%           
=======================================
  Files         140      140           
  Lines       18685    18685           
  Branches     3058     3058           
=======================================
  Hits        12885    12885           
  Misses       5153     5153           
  Partials      647      647           
Files with missing lines Coverage Δ
beets/importer/tasks.py 90.92% <0.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@snejus snejus force-pushed the fix-imported-items-crash branch from 4c5fd32 to d998da2 Compare January 31, 2026 23:46
@snejus snejus enabled auto-merge January 31, 2026 23:47
@snejus snejus force-pushed the fix-imported-items-crash branch from d998da2 to d2600c3 Compare January 31, 2026 23:48
@snejus snejus merged commit b2335b9 into master Jan 31, 2026
18 checks passed
@snejus snejus deleted the fix-imported-items-crash branch January 31, 2026 23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants