Skip to content
This repository was archived by the owner on Apr 15, 2026. It is now read-only.
This repository was archived by the owner on Apr 15, 2026. It is now read-only.

[BUG] After setting up access token, the bot is unable to find correct session id in decryption #48

Description

@MalcolmMielle

Thanks for the great library. I have a problem when switching to the access token

Describe the bug
The bot worked fine with the password. After switching to the access token I have the error "Error decrypting megolm event, no session found with session id XXXXX".
Switching back to the password, the bot seems to still be broken with the same error.

Changing the device_id and using the password again makes the bot functional again.

To Reproduce

Create a ping bot. use niocli to generate the access token. Join a room with the bot and try to use the ping command. The error is then:

Received a undecryptable Megolm event from a device with no Olm sessions: @account:homeserver SOMESESSIONVALUE
Error decrypting megolm event, no session found with session id LONGIDSESSION for room !ROOMNAME:homeserver

Expected behavior
The bot should behave the same with the access token and the password.

Activity

  1. timedoutuk commented on Jul 10, 2025

    @timedoutuk
    Owner

    How are you getting the access token? To use an E2EE-ready access token, you need to use niocli get-access-token or call /login on the API manually. Tokens fetched from another client, like Element, will already have crypto initialised, so can't be re-used.

  2. MalcolmMielle commented on Jul 10, 2025

    @MalcolmMielle
    Author

    I got the access token using niocli get-access-token in the terminal

  3. timedoutuk commented on Jul 10, 2025

    @timedoutuk
    Owner

    That's odd. Is your store_path set to a permenant filesystem (i.e. not in a container or on a tmpfs)?

  4. MalcolmMielle commented on Jul 10, 2025

    @MalcolmMielle
    Author

    It is in the root folder of the python repo I am using at the moment. I'm not using any sort of container for now.

    It is very odd indeed, I don't know if the fact that I am using a beeper account to send the message matters. I also have tried using an account on matrix.org and got a similar result

  5. timedoutuk commented on Jul 10, 2025

    @timedoutuk
    Owner

    Okay so just to confirm, running niocli get-access-token to get a fresh access token, and then using both the access token and device ID it produces, it still isn't able to decrypt?

    The server shouldn't matter

  6. MalcolmMielle commented on Jul 11, 2025

    @MalcolmMielle
    Author

    Yeah exactly. I have a bot that works with the password. I switch to access_token in the run and I get an access token with niocli and it is unable to decrypt.

    If you want to have a check, it is a the matrix bot class in this repo: https://codeberg.org/MalcolmMielle/bark_monitor and this class (with the password part in run replaced to access_token)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions