Fix: handle non-JSON Invidious API responses gracefully#8756
Closed
Houmgaor wants to merge 1 commit intoFreeTubeApp:developmentfrom
Closed
Fix: handle non-JSON Invidious API responses gracefully#8756Houmgaor wants to merge 1 commit intoFreeTubeApp:developmentfrom
Houmgaor wants to merge 1 commit intoFreeTubeApp:developmentfrom
Conversation
When an Invidious instance returns non-JSON responses (e.g. "API disabled" plain text), the app previously crashed with a cryptic SyntaxError from JSON.parse. Now the response is read as text first, HTTP status is checked, and JSON parsing is wrapped in a try/catch, so the actual server message (e.g. "API disabled") is shown as the error instead. Fixes FreeTubeApp#7194, fixes FreeTubeApp#7160, relates to FreeTubeApp#7883, FreeTubeApp#8527, FreeTubeApp#5720, FreeTubeApp#5506
auto-merge was automatically disabled
March 6, 2026 09:46
Head branch was pushed to by a user without write access
auto-merge was automatically disabled
March 6, 2026 09:47
Pull request was closed
Member
|
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.
Summary
"API disabled"), the app currently crashes withSyntaxError: Unexpected token 'A', "API disabled" is not valid JSONresponse.ok, and wrapsJSON.parsein a try/catch, so the actual server message is surfaced as the error instead of a cryptic JSON parse failurerelates to #7883, #8527, #5720, #5506
Test plan
{"error": "..."}) are still handled as before