Skip to content

lyrics plugin search failure related to genius.com #6877

Description

@foodiddy

Problem

Running this command in verbose (-vv) mode:

$ beet -vv lyrics confuser

Led to this problem:

user configuration: /home/foo/.config/beets/config.yaml
data directory: /home/foo/.config/beets
plugin paths:
lyrics: Disabling google source: no API key configured.
Sending event: pluginload
library database: /home/foo/.beets/musiclibrary.db
library directory: /mnt/crates/library
Sending event: library_opened
Parsed query: AndQuery([AnyFieldQuery('confuser', ('artist', 'title', 'comments', 'album', 'albumartist', 'genre'), SubstringQuery)])
Parsed sort: NullSort()
Traceback (most recent call last):
  File "/usr/bin/beet", line 8, in <module>
    sys.exit(main())
             ~~~~^^
  File "/usr/share/beets/beets/ui/__init__.py", line 1870, in main
    _raw_main(args)
    ~~~~~~~~~^^^^^^
  File "/usr/share/beets/beets/ui/__init__.py", line 1849, in _raw_main
    subcommand.func(lib, suboptions, subargs)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/beets/beetsplug/lyrics.py", line 880, in func
    self.fetch_item_lyrics(
    ~~~~~~~~~~~~~~~~~~~~~~^
        lib,
        ^^^^
    ...<2 lines>...
        opts.force_refetch or self.config["force"],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/share/beets/beetsplug/lyrics.py", line 992, in fetch_item_lyrics
    self.get_lyrics(artist, title, album=album, length=length)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/beets/beetsplug/lyrics.py", line 1028, in get_lyrics
    lyrics = backend.fetch(artist, title, album=album, length=length)
  File "/usr/share/beets/beetsplug/lyrics.py", line 380, in fetch
    for hit in json["response"]["hits"]:
               ~~~~^^^^^^^^^^^^
KeyError: 'response'

Here's a link to the music files that trigger the bug (if relevant):
Searching for anything that did not previously have lyrics already will cause this problem/

Setup

  • OS: Debian 13.6 (trixie)
  • Python version: 3.13.5
  • beets version: 2.1.0
  • Turning off plugins made problem go away (yes/no): yes

My configuration (output of beet config) is:

lyrics:
    bing_lang_from: []
    auto: yes
    bing_client_secret: REDACTED
    bing_lang_to:
    google_API_key: REDACTED
    google_engine_ID: REDACTED
    genius_api_key: REDACTED
    fallback:
    force: no
    local: no
    synced: no
    sources:
    - google
    - genius
    - tekstowo
    - lrclib
    dist_thresh: 0.1
directory: /mnt/crates/library
# --------------- Main ---------------

library: /home/foo/.beets/musiclibrary.db

# --------------- Plugins ---------------

plugins: chroma lyrics duplicates edit scrub info mbsync fromfilename

match:
    strong_rec_thresh: 0.39

import:
    autotag: yes
    move: yes
    quiet: no
    resume: yes
    log: /home/foo/.beets/import.log
chroma:
    auto: yes
musicbrainz:
    extra_tags:
    - year
    - catalognum
    - country
    - media
    - label
scrub:
    auto: yes
edit:
    albumfields: album albumartist
    itemfields: track title artist album
    ignore_fields: id path
duplicates:
    album: no
    checksum: ''
    copy: ''
    count: no
    delete: no
    format: ''
    full: no
    keys: []
    merge: no
    move: ''
    path: no
    tiebreak: {}
    strict: no
    tag: ''

Metadata

Metadata

Assignees

No one assigned

    Labels

    lyricslyrics plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions