matrix-archive icon indicating copy to clipboard operation
matrix-archive copied to clipboard

Traceback

Open markvdb opened this issue 4 years ago • 0 comments

Hello,

I bumped into the below Traceback when matrix-archive barfed out on my wrong input (wrong e2e room keys password probably). You might want to make sure a more informative error message is emitted.

Kind regards,

Mark

P.S. Thank you for your work on matrix-archive. I really appreciate it!

./matrix-archive.py 
Enter URL of your homeserver: [https://matrix-client.matrix.org] 
Enter your full user ID: [@user:matrix.org] @my_user_id:matrix.org
Password: 
Enter full path to room E2E keys: [element-keys.txt] /path_to_my_keys/element-keys.txt
Room keys password: 
Importing keys. This may take a while...
Traceback (most recent call last):
  File "/home/mark/.local/lib/python3.9/site-packages/nio/crypto/olm_machine.py", line 2129, in import_keys_static
    data = decrypt_and_read(infile, passphrase)
  File "/home/mark/.local/lib/python3.9/site-packages/nio/crypto/key_export.py", line 70, in decrypt_and_read
    return decrypt(encrypted_data[len(HEADER) : -len(FOOTER)], passphrase)
  File "/home/mark/.local/lib/python3.9/site-packages/nio/crypto/key_export.py", line 133, in decrypt
    raise ValueError("HMAC check failed for encrypted payload.")
ValueError: HMAC check failed for encrypted payload.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mark/matrix-archive/./matrix-archive.py", line 369, in main
    client = await create_client()
  File "/home/mark/matrix-archive/./matrix-archive.py", line 198, in create_client
    await client.import_keys(room_keys_path, room_keys_password)
  File "/home/mark/.local/lib/python3.9/site-packages/nio/client/async_client.py", line 1947, in import_keys
    sessions = await loop.run_in_executor(None, import_keys)
  File "/usr/lib/python3.9/concurrent/futures/thread.py", line 52, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/mark/.local/lib/python3.9/site-packages/nio/crypto/olm_machine.py", line 2131, in import_keys_static
    raise EncryptionError(e)
nio.exceptions.EncryptionError: HMAC check failed for encrypted payload.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mark/matrix-archive/./matrix-archive.py", line 401, in 
    asyncio.get_event_loop().run_until_complete(main())
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/home/mark/matrix-archive/./matrix-archive.py", line 391, in main
    await client.logout()
UnboundLocalError: local variable 'client' referenced before assignment
Unclosed client session
client_session: 

markvdb avatar Feb 11 '21 10:02 markvdb