Android: "An error occurred while processing notifications" instead of the message #41

Open
opened 2026-10-05 19:21:21 +00:00 by robocub · 0 comments
Owner

Upstream: commetchat/commet#610, commetchat/commet#810. Both are open with no assignee, no PR and no branch, as of 2026-10-05.

On Android, a push often produces an "An error occurred while processing notifications" alert with "Unable to fetch room event for notification" instead of the message. Upstream reporters say it affects most notifications after the phone has been idle for a while, and works while the phone is in use. Reported here by the operator too.

Where: lib/service/background_service_notifications/background_service_task_notification2.dart handleMessage(). The background service opens a MatrixBackgroundClient built from the access token stored in the database (matrix_background_client.dart init()). It then calls getOneRoomEvent 5 times with 0–8 s backoff. If every attempt throws, the exception becomes a user-facing error notification. The cause is printed after the line break in that notification's text (or in Settings › Developer logs).

Candidate causes (unconfirmed, need the exception text):

  1. Expired access token. If the account uses refresh tokens (OIDC / MSC3861 login), the background client reuses a stored access token and never refreshes it. The foreground client refreshes it while the app is in use, which fits "works while I'm using the phone, fails after idle". Expect M_UNKNOWN_TOKEN / 401 in the exception.
  2. No network in Doze. The push wakes the service, but the network is still restricted. Expect SocketException / ClientException.

Fix plan:

  • Get the actual exception from an affected device first.
  • Fix the cause (refresh the token in the background client, or wait for connectivity).
  • Regardless of cause: never show internal errors as alerts. If the event can't be fetched, show a plain "New message in " notification (the room id/name is known from the push) and log the error. The current alert drops the message notification and is noise.

Also seen upstream (#810 comments): after opening the app, a burst of notifications for every message since the app was last opened. Possibly related; check while in here.

Upstream: [commetchat/commet#610](https://github.com/commetchat/commet/issues/610), [commetchat/commet#810](https://github.com/commetchat/commet/issues/810). Both are open with no assignee, no PR and no branch, as of 2026-10-05. On Android, a push often produces an **"An error occurred while processing notifications"** alert with *"Unable to fetch room event for notification"* instead of the message. Upstream reporters say it affects most notifications after the phone has been idle for a while, and works while the phone is in use. Reported here by the operator too. **Where:** `lib/service/background_service_notifications/background_service_task_notification2.dart` `handleMessage()`. The background service opens a `MatrixBackgroundClient` built from the access token stored in the database (`matrix_background_client.dart` `init()`). It then calls `getOneRoomEvent` 5 times with 0–8 s backoff. If every attempt throws, the exception becomes a user-facing error notification. The cause is printed after the line break in that notification's text (or in Settings › Developer logs). **Candidate causes (unconfirmed, need the exception text):** 1. **Expired access token.** If the account uses refresh tokens (OIDC / MSC3861 login), the background client reuses a stored access token and never refreshes it. The foreground client refreshes it while the app is in use, which fits "works while I'm using the phone, fails after idle". Expect `M_UNKNOWN_TOKEN` / 401 in the exception. 2. **No network in Doze.** The push wakes the service, but the network is still restricted. Expect `SocketException` / `ClientException`. **Fix plan:** - Get the actual exception from an affected device first. - Fix the cause (refresh the token in the background client, or wait for connectivity). - Regardless of cause: never show internal errors as alerts. If the event can't be fetched, show a plain "New message in <room>" notification (the room id/name is known from the push) and log the error. The current alert drops the message notification and is noise. Also seen upstream (#810 comments): after opening the app, a burst of notifications for every message since the app was last opened. Possibly related; check while in here.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
robocub/vommet#41
No description provided.