fix(media-check): show errors instead of crashing - #22171
Open
criticalAY wants to merge 1 commit into
Open
criticalAY wants to merge 1 commit into
criticalAY wants to merge 1 commit into
Conversation
david-allison
approved these changes
Sep 29, 2026
Opening Check Media crashed when the backend failed. On GrapheneOS with Storage Scopes, listing an empty media folder returns 'Operation not permitted (os error 1)', so every check crashed. Assisted-by: Opus 5.5 (Analysis of root cause)
criticalAY
force-pushed
the
fix/media-check-error-handling
branch
from
September 29, 2026 20:23
ad9c955 to
4f22f88
Compare
Contributor
Author
|
Added a TODO for now |
criticalAY
enabled auto-merge
September 29, 2026 20:28
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Sep 29, 2026
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 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.
Note
Assisted-by: Opus 5.5 (Analysis of root cause)
Purpose / Description
Opening Check Media crashes the app if the backend throws. On GrapheneOS with Storage Scopes, listing an empty folder (usually
media.trash) fails withOperation not permitted (os error 1), so every check crashes.All five
MediaCheckViewModelops were a bareviewModelScope.launch, so a failure went straight to the uncaught exception handler. The fragment'slaunchCatchingTask { op().join() }couldn't catch it, becausejoin()returns normally when the job fails. The check on open wasn't wrapped at all. This has been broken since 2.21alpha14.Fixes
Approach
The ViewModel ran its operations with viewModelScope.launch, so a failure went straight to the uncaught exception handler. Wrapping them in launchCatchingTask did not help: join() returns normally when the job fails, and the check on open was not wrapped at all.
So the operations now return a Deferred which the fragment awaits, so failures reach launchCatchingTask and show the usual error dialog. sThe result dialogs are no longer shown after a failure.
How Has This Been Tested?
MediaCheckFragmentTestLearning (optional, can help others)
NA
Checklist
Please, go through these checks before submitting the PR.