element-ios: Error message "Unable to decrypt. MatrixSDKCrypto.DecryptionError" appears randomly in a chat with a single user

Steps to reproduce

I self-host a dendrite instance (via docker, federation disabled) on a Raspberry Pi 4 (4GB) where there are at the moment only 2 users in total. One user uses element on iOS and randomly gets an error message where it has been impossible to establish the steps to reproduce how to get that error. The error appears randomly when the chat window with the other user is opened or when a message is being typed. It is also difficult to foresee how often the error will happen. Sometimes it can be twice a day, while other times it could be once a week.

The other user – which uses element on an Android device – has never experienced the error described in this issue.

Outcome

The user using element on iOS expects to write a message but it is instead sometimes and randomly presented with the error as in the following screenshot:

ima_f2bd398

** Unable to decrypt: Handlingen kunne ikke udføres. 
(MatrixSDKCrypto.DecryptionError fejl 2.) **

Element iOS interface is set in English but the iOS system language is Danish. Handlingen kunne ikke udføres could be translated as The operation couldn't be performed. Fejl in Danish is Error.

Additional information taken from the Element iOS settings that might help:

Matrix SDK 0.26.10
Rust Crypto SDK 0.6.0 (Vodozemac 0.3.0)

Your phone model

iPhone 8

Operating system version

iOS 16.5

Application version

Element 1.10.12 (20230516163937)

Homeserver

Dendrite 0.12.0+74dc546

Will you send logs?

No

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Reactions: 2
  • Comments: 17 (1 by maintainers)

Most upvoted comments

Was about to create that same issue. Happens to all IOS users and nearly daily, happens never on any other platforms. Annoyance factor is very high.

Addional investigation comments:

  • It happens also with Synapse
  • It even more likely happens if the user has more than one devices, sends a message on device A and device B shows this error (although the message was successfully sent on device A - no need for any resend)
  • It’s not limited to encrypted rooms only! Can happen in unencrypted rooms as well, in this case the message is shown “greyish” (like a message which was not sent yet) instead of the mentioned encryption error above. But you’ll find the message successfully sent in your chat further above.
  • “Retry” never works! You need to tap the waste icon to delete it. In 10% of the cases even this does not work and you need to clear the cache to get rid of this error in the chat.
  • Uncertainity is high for the users as they always think one of their messages did not make it to the server. In encrypted rooms they can’t even double check as they simply see the “Fail 2 Error” instead of the message content.

@Velin92 In my user base it’s not occasional - it happens nearly daily to all users with the IOS app. I even listed it in my “Troubleshooting FAQ”

Can someone please chime into as why this is closed? This is a SEVERE bug. As a very long-time Element (Riot/Matrix) user, going way, way back, and in fact even a paying user of various services, even trying the Signal bridge (which was cancelled unceremoniously! I might add, without a word), etc, as a multi-platform user, who up until this point was on macOS, Windows, Linux, and Android (but iOS very limited using only an iPad which worked without this problem), this is now a completely DAILY occurrence), making Element almost unusable!

(having written a long explanation that’s just not necessary, I’ll simply say: I thank the developers for all of the extremely hard work, but this is making Element nearly impossible to use! And we try to use it as a PRIMARY communications channel!)

Truly, due to recently switching to iOS from Android due to a number of factors, this is nearly unusable, as missing messages, missing attachments, and other problems make it unreliable.

Please open this issue once again!

@garret @Velin92

The IOS app is unusable. Unclear on why this is labelled ‘minor’, there should be no higher item than this.

I thought perhaps the user I was having issues with was at fault in some way, but yesterday I removed our chat in person and started a new room and manually got both of their IOS devices cross verified (difficult due to how buggy the verification interface is on IOS.) Today after they shared a link, we’re back to grey messages about decryption.

Steps to reproduce:

  • One user with two IOS devices / sessions
  • Second user with two devices / session (Element for Android + Element for Linux)
  • Everything cross verified in person, green on all sessions, on all devices.
  • IOS user shares a link

Also having this:

  1. sent text from Element iOS app, received fine by recipient’s iOS app.
  2. Open MacOS Desktop app, message says “Unable to decrypt message” and I cannot view the message I sent on desktop.
  3. View source of message, shows this error:
{
  "type": "m.room.message",
  "content": {
    "msgtype": "m.bad.encrypted",
    "body": "** Unable to decrypt: DecryptionError: Duplicate message index, possible replay attack: 
  1. This seems related to https://github.com/vector-im/element-web/issues/25108 but is not happening via the share screen, just regular message entry.
  2. intermittent– I have not figured out further variables to make it happen every time, but it has happened about a dozen times in the last two weeks. Similar errors show up on Cinny (including the share-to decryption error), which implies that it is more of an iOS bug than it is Element-Desktop bug, since only iOS produces the errors in other clients, other clients never produce the error for iOS.

@discoltk Using the Share Extension is definitely broken, it produces wrong message indices: https://github.com/vector-im/element-ios/issues/7499

That’s one thing I have no understanding that this is also not major with highest priority.

I still do not understand why there is no server configuration to have the ability that DM chat rooms are clear by default and the encryption can be enabled by the participants if they want E2EE. There are still so many E2EE bugs, especially in IOS.

And creating unencrypted DM rooms is possible, but a mess for both sides as action is required (set the room to DM etc.).