beets icon indicating copy to clipboard operation
beets copied to clipboard

Unclear error message when starting beets without `EDITOR` set

Open fullerth opened this issue 1 month ago • 4 comments

Problem

Running this command in verbose (-vv) mode without EDITOR set

$ beet -vv config -e

Led to this problem:

error: Could not edit configuration: [Errno 2] No such file or directory

I would expect to see the message be: https://github.com/beetbox/beets/blob/d446e10fb0a863ff5fad0d6106fd4acaad306fc2/beets/ui/commands/config.py#L61

May be related to #2847?

Setup

  • OS: Debian v13.2
  • Python version: 3.13.5 (main, Jun 25 2025, 18:55:22) [GCC 14.2.0]
  • Installed with pipx
  • beets version: beets version 2.5.1
  • Turning off plugins made problem go away (yes/no): no

My configuration (output of beet config) is:

disabled_plugins: []
musicbrainz:
    search_limit: 5
    data_source_mismatch_penalty: 0.5
    host: musicbrainz.org
    https: no
    ratelimit: 1
    ratelimit_interval: 1
    genres: no
    external_ids:
        discogs: no
        bandcamp: no
        spotify: no
        deezer: no
        tidal: no
    extra_tags: []

fullerth avatar Nov 22 '25 09:11 fullerth

Thank you for the bug report! I agree the error message is pretty confusing as the file does exist!

I think the issue is not that the environment variables are not set/none but that the set string is nonsensical.

Try for instance

VISUAL="foo" EDITOR="" beet -vv config -e
> error: Could not edit configuration: [Errno 2] No such file or directory

semohr avatar Nov 22 '25 15:11 semohr

To what values are your VISUAL and EDITOR variable set?

For me setting both to none still opens my standard editor because of the open_aynthing fallback. https://github.com/beetbox/beets/blob/d446e10fb0a863ff5fad0d6106fd4acaad306fc2/beets/util/init.py#L948

semohr avatar Nov 22 '25 15:11 semohr

Yep, to be clear, the bug is the unhelpful error message. The system this is running on was not correctly configured, so an error was appropriate. This is a fairly bare headless Debian VM, with EDITOR and VISUAL both unset and xdg-open not installed.

Setting any of the environment variables correctly causes the config file to open in the specified editor.

Installing xdg-utils, (but without configuring xdg as I don't currently have a desktop environment) also changes to a more coherent error:

$ unset EDITOR
$ unset VISUAL
$ beet config -e
/usr/bin/xdg-open: 1032: www-browser: not found
/usr/bin/xdg-open: 1032: links2: not found
/usr/bin/xdg-open: 1032: elinks: not found
/usr/bin/xdg-open: 1032: links: not found
/usr/bin/xdg-open: 1032: lynx: not found
/usr/bin/xdg-open: 1032: w3m: not found
xdg-open: no method available for opening '/mnt/unraid/media/beets.d/config.yaml'

If you'd like, I think I can fix this. The open_anything call gives me enough to go on to propagate a better error message, but it'll take me a few days to get a dev environment setup.

fullerth avatar Nov 22 '25 22:11 fullerth

Sure, please go ahead and give it a try! We’re always excited to welcome new contributors. You can find our getting-started guide here.

If you run into any issues with the setup or have any questions in general, don’t hesitate to reach out. We’re happy to help!

semohr avatar Nov 23 '25 13:11 semohr