Repository navigation
Log failed metadata searches without a traceback at error level - #7119
Merged
Merged
Conversation
When a metadata source such as MusicBrainz is unreachable, _search_api logged the requests exception with exc_info=True, printing a long urllib3 traceback for every search. Log the message at error level and the traceback at debug level for requests exceptions, as maybe_handle_plugin_error already does. Fixes #6960
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7119 +/- ##
==========================================
- Coverage 80.62% 80.61% -0.02%
==========================================
Files 149 149
Lines 21254 21261 +7
Branches 3284 3285 +1
==========================================
+ Hits 17136 17139 +3
- Misses 3290 3293 +3
- Partials 828 829 +1
🚀 New features to boost your workflow:
|
snejus
approved these changes
Oct 29, 2026
snejus
left a comment
Member
There was a problem hiding this comment.
Thanks - please run poe format-docs.
snejus
enabled auto-merge
October 29, 2026 19:40
auto-merge was automatically disabled
October 30, 2026 02:23
Head branch was pushed to by a user without write access
snejus
enabled auto-merge
November 1, 2026 11:52
snejus
disabled auto-merge
November 1, 2026 12:03
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #6960.
When MusicBrainz is down or unreachable,
beet importprints a 50-line urllib3/requests traceback for every search._search_apiinbeets/metadata_plugins.pycatches the error but logs it at error level withexc_info=True.Search failures caused by
requests(ConnectionError,Timeout, retries exhausted, HTTP errors) now log the one-line message at error level, for exampleError searching MusicBrainz: HTTPSConnectionPool(host='musicbrainz.org', port=443): Max retries exceeded ..., and keep the traceback at debug level. That is howmaybe_handle_plugin_errorin the same module already logs plugin failures.raise_on_errorstill re-raises, and errors that are not fromrequestskeep the full traceback, since those are more likely bugs.The thread suggested catching connection errors in
RequestHandlerinstead. I kept the change in_search_apibecause every search-based metadata source goes through it, including plugins that do not useRequestHandler, and the plugins' other error handling stays as it is. Happy to move it if you prefer that layer.The new test in
test/test_metadata_plugins.pymakesget_search_responseraiseConnectionErrorand checks that the error record has the message and no traceback. It fails without the change.Tests:
pytest test/test_metadata_plugins.py test/plugins/test_musicbrainz.py, 73 passed (72 before the new test).This change was prepared with an AI coding assistant (Claude Code, claude-sonnet-5-5) and reviewed before submission.
To Do
Documentation.