Skip to content

False duplicate detection for distinct albums with identical artist and title #7026

Description

@gbcox

Problem

beet import -A incorrectly identifies distinct albums as duplicates when they have the same album artist and official album title, even though they have different MusicBrainz release IDs, release-group IDs, barcodes, track lists, and durations.

Running this command in verbose (-vv) mode with all plugins disabled:

$ beet --plugins= -vv import -A /mnt/unas/music/santana/santana

Led to this problem:

configuration sources (highest → lowest priority):
YamlSource /home/gbcox/.config/beets/config.yaml
YamlSource /usr/lib/python3.14/site-packages/beets/config_default.yaml
data directory: /home/gbcox/.config/beets
plugin paths: ['/home/gbcox/.config/beets']
Loading plugins:
Sending event: pluginload
library database: /home/gbcox/.config/beets/library.db
library directory: /home/gbcox/music
Sending event: library_opened
Sending event: import_begin
Sending event: import_task_created
/mnt/unas/music/santana/santana
found duplicates: [1740]
default action for duplicates: a
This album is already in the library!
Old: 12 items, FLAC, 914kbps, 44.1kHz/16 bit, 56:38, 370.1 MiB
New: 12 items, FLAC, 841kbps, 44.1kHz/16 bit, 61:43, 368.0 MiB
➜ [S]kip new, Merge all, Remove old, Keep all, Upgrade? s
Sending event: import
Sending event: cli_exit

The two albums are distinct MusicBrainz release groups.

The incoming directory contains Santana’s 1969 self-titled debut:

directory: /mnt/unas/music/santana/santana
album: Santana
albumartist: Santana
mb_albumid: 43ca95e6-8d1e-4165-99a8-e6fd5a993500
mb_releasegroupid: cbe55545-7a3e-3f8c-8c5f-33984a818e91
barcode: 888751061828
originaldate: 1969-08-30
tracks: 12
duration: 61:43

The existing album reported as the duplicate is the separate 1971 album commonly known as Santana III:

directory: /mnt/unas/music/santana/santana_iii
album: Santana
albumartist: Santana
mb_albumid: 7a36ef45-f1c4-44c5-ae5a-7d9cabfe2718
mb_releasegroupid: 6258df90-78c7-3395-8830-e7b4328a002c
barcode: 886977109324
originaldate: 1971-09
tracks: 12
duration: 56:38

MusicBrainz gives both albums the official title Santana. It displays (III) as a disambiguation for the 1971 release group, not as part of the album title.

The releases also contain different recordings. For example, their first tracks are:

1969 album:
title: Waiting
mb_trackid: 3bdbec76-5091-4fa5-b073-c984f75c1abd
mb_releasetrackid: 06dd02f2-519b-42d4-8bc9-e14e932c697b

1971 album:
title: Batuka
mb_trackid: ee00d3bc-699b-4032-b3a2-907fde08f9d3
mb_releasetrackid: f9bea87d-c72f-4f17-bc3f-054d627e874a

Running the import on the other directory reverses the comparison:

$ beet --plugins= -vv import -A /mnt/unas/music/santana/santana_iii

Beets then treats the 1969 album as the existing duplicate and the 1971 album as the incoming album.

This is not limited to Santana. The same behavior occurs with Weezer’s multiple officially self-titled albums. When importing one of them, beets presents several of the other self-titled Weezer albums as duplicate candidates:

This album is already in the library!

Old: 10 items, FLAC, 999kbps, 44.1kHz/16 bit, 36:24, 261.6 MiB
Old: 10 items, FLAC, 1031kbps, 44.1kHz/16 bit, 37:43, 278.7 MiB
Old: 10 items, FLAC, 986kbps, 44.1kHz/16 bit, 41:18, 287.5 MiB
Old: 10 items, FLAC, 1008kbps, 44.1kHz/16 bit, 34:10, 246.0 MiB
New: 10 items, FLAC, 1040kbps, 44.1kHz/16 bit, 28:19, 210.7 MiB

The Weezer albums have different track lists, durations, MusicBrainz release IDs, and MusicBrainz release-group IDs. Their shared official artist and album title should not cause them to be classified as duplicates.

It appears that duplicate detection relies on album artist and album title without sufficiently considering the available MusicBrainz identifiers.

Expected behavior

  • An incoming album with a nonempty mb_albumid should match only the corresponding MusicBrainz release already in the library.
  • Albums with different nonempty mb_releasegroupid values should not be presented as duplicates.
  • When reimporting an existing directory, beets should update the album associated with that path or MusicBrainz release ID rather than compare it with unrelated albums that merely share the same artist and title.

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

The music files are not publicly available.

Setup

  • OS: Fedora 44
  • Python version: 3.14.7
  • beets version: 2.14.0
  • Turning off plugins made problem go away (yes/no): No

My configuration (relevant portion of beet config) is:

import:
    write: no
    copy: no
    move: no
    quiet_fallback: asis
    autotag: no

match:
    preferred:
        media:
            - CD

The issue was reproduced using --plugins=, so no plugins were loaded during the test.
rhbz#2532646

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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