beetbox / beetbox/beets

crash after resuming import

Open
#5,156 7 comments 2 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
15.7k
Forks
2.1k
Avg merge
4d 21h
Merged PRs (30d)
31

Description

### Problem
Trying to resume an import over ssh. My laptop fell asleep and the import stopped.

Running this command in verbose (`-vv`) mode:

```sh
$ beet -vv import /media/plex/music
```

Led to this problem:

```
Traceback (most recent call last):
File "/usr/bin/beet", line 33, in
sys.exit(load_entry_point('beets==1.6.0', 'console_scripts', 'beet')())
File "/usr/share/beets/beets/ui/__init__.py", line 1285, in main
_raw_main(args)
File "/usr/share/beets/beets/ui/__init__.py", line 1272, in _raw_main
subcommand.func(lib, suboptions, subargs)
File "/usr/share/beets/beets/ui/commands.py", line 973, in import_func
import_files(lib, paths, query)
File "/usr/share/beets/beets/ui/commands.py", line 943, in import_files
session.run()
File "/usr/share/beets/beets/importer.py", line 340, in run
pl.run_parallel(QUEUE_SIZE)
File "/usr/share/beets/beets/util/pipeline.py", line 446, in run_parallel
raise exc_info[1].with_traceback(exc_info[2])
File "/usr/share/beets/beets/util/pipeline.py", line 311, in run
out = self.coro.send(msg)
File "/usr/share/beets/beets/util/pipeline.py", line 193, in coro
func(*(args + (task,)))
File "/usr/share/beets/beets/importer.py", line 1376, in lookup_candidates
task.lookup_candidates()
File "/usr/share/beets/beets/importer.py", line 660, in lookup_candidates
autotag.tag_album(self.items, search_ids=self.search_ids)
File "/usr/share/beets/beets/autotag/match.py", line 461, in tag_album
for matched_candidate in hooks.album_candidates(items,
File "/usr/share/beets/beets/plugins.py", line 573, in decorated
for v in generator(*args, **kwargs):
File "/usr/share/beets/beets/autotag/hooks.py", line 629, in album_candidates
yield from plugins.candidates(items, artist, album, va_likely,
File "/usr/share/beets/beets/plugins.py", line 384, in candidates
yield from plugin.candidates(items, artist, album, va_likely,
File "/usr/share/beets/beets/plugins.py", line 732, in candidates
results = self._search_api(query_type='album', filters=query_filters)
File "/usr/share/beets/beetsplug/deezer.py", line 222, in _search_api
response.raise_for_status()
File "/usr/lib/python3/dist-packages/requests/models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.deezer.com/search/album?q=album%3A%22Now+%28Deluxe%29%22+artist%3A%22Shania+Twain%22
```

Here's a link to the music files that trigger the bug (if relevant):

### Setup

* OS: Ubuntu 22.04.4 LTS
* Python version: 3.10.12
* beets version: 1.6.0
* Turning off plugins made problem go away (yes/no): yes - deezer, discogs

My configuration (output of `beet config`) is:

```yaml
directory: /media/plex/music
library: ~/data/musiclibrary.db
import:
copy: no
duplicate_action: keep
match:
strong_rec_thresh: 0.10
plugins: discogs deezer

deezer:
source_weight: 0.0

```

Contributor guide

Open the contributing guide

Research direction

Start with the reported `beet -vv import /media/plex/music` command and trace the failure into `beetsplug/deezer.py`, `_search_api`, where `response.raise_for_status()` raises the 403 error. Review linked pull request #5421 and the related import/plugin flow; done should be established by confirming that resuming the import no longer crashes on this Deezer response.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.