element-hq / element-ios

A glossy Matrix collaboration client for iOS
https://element.io
Apache License 2.0
1.73k stars 486 forks source link

Error message "Unable to decrypt. MatrixSDKCrypto.DecryptionError" appears randomly in a chat with a single user #7591

Open garret opened 1 year ago

garret commented 1 year ago

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

jacotec commented 1 year ago

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:

@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"

discoltk commented 1 year ago

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:

jacotec commented 1 year ago

@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.).

angloromanticism commented 1 year ago

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: 
  4. 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.
  5. 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.
OmidH commented 1 year ago

Bug still exists on newest element app version and latest synapse homeserver.

Unable to decrypt: The operation couldn’t be completed. (MatrixSDKCrypto.DecryptionError error 2.)

leematos commented 1 year ago

I just hit this today with a failed call in a 1:1 chat -- I recently used the share menu to share a picture in that channel, so I suspect that triggered the issue?

I'm trying to clear the cache and see if that helps. (Will know more on next call attempt)

RealYHD commented 1 year ago

I'm also here to stress the significance of this issue and contribute what I know.

I am slowly attempting to move family over to Element and many of them have IOS devices. This issue has cropped up when a family member installed Element onto a new iOS device in which I do not have physical access to. This leaves me and this family member to only be able to switch to another platform to communicate in an attempt to fix the issue.

The error message is also unreasonably inutile leaving this family member effectively helpless. The obvious question is then why don't we just switch off the platform? I wholeheartedly agree with @discoltk that this issue should be considered non-minor as for non tech-literate folks, this effectively makes the Element app completely impractical in the best case scenario.

To be clear, I like Matrix protocol and it's objectives hence my efforts in having family try it out. I would personally be disheartened to switch to another platform, however, there is a threshold of practicality that must be considered.

jacotec commented 1 year ago

@RealYHD I pretty much think this is really related to the issues with the IOS Share Extension in Element-IOS, which has been disabled with the latest release.

Not using the share extension did not give me this error in the last weeks. Can you check any relation of the bug to the fact that some user used the (still existing in 1.10.x) share extension in IOS?

RealYHD commented 1 year ago

@RealYHD I pretty much think this is really related to the issues with the IOS Share Extension in Element-IOS, which has been disabled with the latest release.

Not using the share extension did not give me this error in the last weeks. Can you check any relation of the bug to the fact that some user used the (still existing in 1.10.x) share extension in IOS?

@jacotec I appreciate your quick response and potential explanation. I don't think they used the share function of the app at all if that is what you're referring to. It seems to have happened when they added a new device today. This should mean the new device is on the latest version as well. It could be a matter of them not verifying the new device as well however, if this is the case, I would point to the error message needing improvement.

This being said, I will check with them. Thanks again.

RealYHD commented 1 year ago

I "manually verified" their new session and they have confirmed that the error has gone away. This does not seem to have been related to IOS share extension.

If Element and Matrix is to go mainstream, I believe the team should try to disambiguate the error messages from something more technical, to something very trivial, such as verifying a device.

This is not the first time this error message has popped up, and the other time, I still don't know what caused it (may be the iOS share function) as I believe the device was verified. It could have been an old version, it could have been iOS uninstalling the app to save space and thereby causing some issue after reinstalling. I'm speculating though. Food for thought. Thanks!

jacotec commented 1 year ago

If Element and Matrix is to go mainstream, I believe the team should try to disambiguate the error messages from something more technical, to something very trivial, such as verifying a device.

I'd even more say: These kind of error messages may not happen at all. I doubt anyone sees this kind of errors in WhatsApp or Signal - and these are exactly what normal users are comparing to. They don't care about technical differences or all the pro points - they just want to have a flawless experience.

garret commented 1 year ago

Unfortunately, the same person with an iPhone I mentioned in my initial post is still experiencing the same issue (probably a bit less) after updating the app to the latest version at the moment of writing. The error seems still to appear randomly (not triggered in this case by the image sharing functionality).

ima_8eb260c

michaelsmoody commented 1 year ago

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

terion-name commented 9 months ago

+1, this is a severe bug (not "minor" at all!) and closing this issue without fix — is irresponsible and unacceptable @Velin92

UPD also, ths appears not only in p2p chats, but in group chats also and for random users (one user reads message ok, other has this error)

ggPeti commented 5 months ago

Thanks @Velin92 for rectifying this. Dismissing and dowplaying severe issues is not the way to handle them. This issue popped up today on the latest version of the iOS app.

Velin92 commented 5 months ago

We are sorry to hear that this issue is still persisting, the thing is that the maintenance of Element is becoming secondary, to give more time to Element X development. I suggested trying the new iOS app Element X, which is faster, more stable, and has a better overall UX, and is getting more and more features to match the ones that also Element has.

TommyTran732 commented 4 months ago

I am running into this problem too :(