Skip to content

Fix #6176: Clear error message when EDITOR not set#6311

Open
MatMacinf wants to merge 3 commits intobeetbox:masterfrom
MatMacinf:bugfix_editor
Open

Fix #6176: Clear error message when EDITOR not set#6311
MatMacinf wants to merge 3 commits intobeetbox:masterfrom
MatMacinf:bugfix_editor

Conversation

@MatMacinf
Copy link

Description

Fixes # #6176.

(...)

To Do

  • [ x] Documentation. (If you've added a new command-line flag, for example, find the appropriate page under docs/ to describe it.)
  • [x ] Changelog. (Add an entry to docs/changelog.rst to the bottom of one of the lists near the top of the document.)
  • [x ] Tests. (Very much encouraged but not strictly required.)

Changed one line to ensure expected behavior as mentioned in the issue, now beet config -e will have info message when no text editor is available.

@MatMacinf MatMacinf requested a review from a team as a code owner January 22, 2026 15:27
@MatMacinf
Copy link
Author

All testing was done on docker image without vi or any other text editor, please let me know if more test is required.

@codecov
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 68.77%. Comparing base (4882b6b) to head (5741be9).
⚠️ Report is 3 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
beets/ui/commands/config.py 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6311   +/-   ##
=======================================
  Coverage   68.77%   68.77%           
=======================================
  Files         140      140           
  Lines       18619    18619           
  Branches     3054     3054           
=======================================
  Hits        12806    12806           
  Misses       5165     5165           
  Partials      648      648           
Files with missing lines Coverage Δ
beets/ui/commands/config.py 75.60% <0.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@westclox-star
Copy link

Nice! just installed today and ran into this confusing error.

except OSError as exc:
message = f"Could not edit configuration: {exc}"
if not editor:
if exc.errno == 2 or not editor:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message below may be a bit misleading in this case because this fails when the user has set the environment variable, but their supplied editor does not exist.

Instead, consider handling FileNotFoundError specifically:

diff --git a/beets/ui/commands/config.py b/beets/ui/commands/config.py
index 15d571324..318985e7f 100644
--- a/beets/ui/commands/config.py
+++ b/beets/ui/commands/config.py
@@ -56,2 +56,4 @@ def config_edit
         interactive_open([path], editor)
+    except FileNotFoundError:
+        raise ui.UserError(f"Editor {editor!r} not found.")
     except OSError as exc:


Bug fixes:

- Added case when none of the editors is present in the environment. :bug:`6176`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Added case when none of the editors is present in the environment. :bug:`6176`
- :ref:`config-cmd`: Improved error message when user-configured editor does not exist. :bug:`6176`

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants