beets-audible icon indicating copy to clipboard operation
beets-audible copied to clipboard

ValueError: property "subtitle" already exists on MediaFile

Open Azlaroc opened this issue 1 month ago • 3 comments

When loading the plugin on recent beets versions (with mediafile ≥0.12.0), it crashes with: ValueError: property "subtitle" already exists on MediaFile

user configuration: /config/config.yaml data directory: /config plugin paths: [] Loading plugins: audible, convert, edit, embedart, fetchart, fromfilename, scrub, web ** error loading plugin audible Traceback (most recent call last): File "/lsiopy/lib/python3.12/site-packages/beets/plugins.py", line 465, in _get_plugin return obj() ^^^^^ File "/lsiopy/lib/python3.12/site-packages/beetsplug/audible.py", line 118, in init self.add_media_field("subtitle", subtitle) File "/lsiopy/lib/python3.12/site-packages/beets/plugins.py", line 352, in add_media_field mediafile.MediaFile.add_field(name, descriptor) File "/lsiopy/lib/python3.12/site-packages/mediafile/init.py", line 346, in add_field raise ValueError(f'property "{name}" already exists on MediaFile') ValueError: property "subtitle" already exists on MediaFile

"Traceback points to audible.py line ~118:"

self.add_media_field("subtitle", subtitle)

Cause

MediaFile added native support for "subtitle" field in version 0.12.0 (October 2025). The plugin blindly tries to add it again without checking if it exists.

Versions

  • beets: [your version, e.g. 1.6.0 or latest]
  • beets-audible: 1.2.1 (latest at time of writing)
  • mediafile: [run pip show mediafile inside container]

Workaround

Delete the offending line:

sed -i '/add_media_field("subtitle"/d' /lsiopy/lib/python3.12/site-packages/beetsplug/audible.py

Plugin loads fine after, full Audible metadata works.

Suggested Fix

Skip adding the field if it already exists:

if "subtitle" not in MediaFile.fields(): MediaFile.add_field("subtitle", ...)

Or remove the add_field entirely since it's now native.

This breaks the plugin on current beets — many users hitting it after container updates.

Thanks!

Azlaroc avatar Jan 04 '26 06:01 Azlaroc

Same issue here

Marcello2022 avatar Jan 06 '26 12:01 Marcello2022

Is this change documented in the changelog anywhere? I'm trying to find where this was added but don't see any mention of this in the Beets or Mediafile changelog.

Using the container specified in the readme should work. I try not to update unnecessarily specifically because of issues like this.

Neurrone avatar Jan 06 '26 12:01 Neurrone

I found https://github.com/beetbox/mediafile/pull/82 introduced the change, released in Mediafile v0.14.0. This is used in https://github.com/beetbox/beets/pull/5696

I won't be fixing this for now. There doesn't seem to be a way for me to easily detect if the field is set already at least in older versions of mediafile. I get the following error when I try to access mediafile.fields() without using a nightly Beets image:

AttributeError: module 'mediafile' has no attribute 'fields'

Please use the version of the image mentioned in the readme. These changes to Mediafile and Beets are also not released properly yet.

Once there's a stable version of Beets with these changes, I'll be happy to update to it and fix this properly.

Neurrone avatar Jan 06 '26 13:01 Neurrone