fix: prevent crash when removing media from null Jellyfin collection#2510
Merged
Conversation
When a Jellyfin media server collection doesn't exist (e.g. auto-deleted when empty), removeChildFromCollection would pass null as collectionId to the Jellyfin SDK, which throws RequiredError. The DB cleanup was also in the same try block, so items became permanently stuck. Guard the API call on non-null mediaServerId and always run DB cleanup. Closes #2509
7c4947d to
a32015a
Compare
enoch85
added a commit
that referenced
this pull request
Mar 21, 2026
PR #2510 - fix: prevent crash when removing media from null Jellyfin collection - Guard removeFromCollection API call when mediaServerId is null - Move DB cleanup outside inner try block so items are always cleaned up - Update parameter type to string | null for type accuracy
Contributor
|
🎉 This PR is included in version 3.2.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Summary
removeFromCollectionAPI call whenmediaServerIdisnull(collection doesn't exist on the media server)CollectionMediadeletion + log record) outside the inner try block so it always executes, even if the API call failsremoveChildFromCollectionparameter type tostring | nullfor type accuracyRoot cause
When a Jellyfin collection doesn't exist (auto-deleted when empty, or never created because "custom collection" is unchecked),
checkAutomaticMediaServerLinkcorrectly setsmediaServerId = null. ButremoveChildFromCollectionpasses thisnullstraight to the Jellyfin SDK, which throwsRequiredError. Since the DB cleanup was in the sametryblock as the API call, items became permanently stuck — every re-run hit the same error for the same items.Test plan
Closes #2509