Repository navigation
Fix create_request crash when nothing is left to request - #486
Merged
felixschndr merged 2 commits intoNov 10, 2026
Merged
Conversation
Collaborator
|
Thanks for the PR! However, I see a few things to do before merging:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #486 +/- ##
==========================================
+ Coverage 99.10% 99.14% +0.03%
==========================================
Files 4 4
Lines 448 469 +21
Branches 13 15 +2
==========================================
+ Hits 444 465 +21
Misses 3 3
Partials 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
Thanks @felixschndr for the thorough review! All three points are addressed in 2336b32:
I've also updated the PR description to match. |
Collaborator
|
Looks good, thanks for the PR |
Collaborator
|
I released this (https://github.com/joostlek/python-overseerr/releases/tag/v0.10.1). In case you are using it for Home Assistant, feel free to open a bump PR, I will merge this then, if not then not :) |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
create_request()crashes with an opaquemashumaro.exceptions.MissingFielderror (Field "id" of type int is missing in RequestWithMedia instance) when there's nothing left to request — e.g. requesting a TV show where every season is already requested or available.Root cause
Overseerr/Seerr's request route doesn't always create a
MediaRequest. When none of the requested seasons can be requested, the server throwsNoSeasonsAvailableError, which the route handler maps to an HTTP 202 with body{"status": 202, "message": "No seasons available to request"}instead of a created request (seeserver/routes/request.tsandserver/entity/MediaRequest.ts).A season counts as "existing" here if it has an open request (pending/approved, same 4K flag) or any media status other than
UNKNOWN/DELETED, so this covers both "already requested" and "already available".Since 202 is a 2xx status,
_request()doesn't raise, so this response reachesRequestWithMedia.from_json(), which fails trying to parse a body with noid,media,requestedBy, etc.(For comparison: a genuine duplicate request throws
DuplicateMediaRequestError, mapped to a real HTTP 409, which_request()already handles correctly by raisingOverseerrConnectionError.)Fix
create_request()now parses the response once and checks for"status": 202in the body. When present, it raises a newOverseerrNothingToRequestErrorwith the server's own message. Otherwise the parsed dict is passed toRequestWithMedia.from_dict().Testing
test_creating_request_nothing_to_request, with a new fixture (no_seasons_available.json, using the real message text from the server source) mirroring the existingoverseerr/seerrfixture split.ruff format,pylint, andmypyall pass locally.