Error when getting `collections` with CLI on Linux

I am getting an error when getting the collections from the Vaultwarden instance installed on my local server.

I am using the CLI posted at https://bitwarden.com/help/cli/.
If I use the Windows version, everything works.
If I use the Linux version (using Ubuntu 22.04), I get the following error: [error: cannot decrypt]

[{'object': 'collection',
  'id': '9df2xxxxxxxxxxx',
  'organizationId': '8f78xxxxxxxxxxxx',
  'name': '[error: cannot decrypt]',
  'externalId': None}]

In order to run the CLI, I am using Python.
I am using the following process:

subprocess. Run("bw list collections", shell=True, capture_output=True, text=True, env=bw_env_session, encoding="utf-8")

And getting this output:

CompletedProcess(args='bw list collections', returncode=0, stdout='[{"object":"collection","id":"9df2xxxxxxxxxxx","organizationId":"8f78xxxxxxxxxxxx","name":"[error: cannot decrypt]","externalId":null}]', stderr='')

Following, the status of the connection, showing that the status is unlocked.

subprocess. Run("bw status", shell=True, capture_output=True, text=True, env=bw_env_session, encoding="utf-8")

Output:

CompletedProcess(args='bw status', returncode=0, stdout='{"serverUrl":"https://vault.mydomain.com","lastSync":"2022-11-20T20:38:57.580Z","userEmail":"my@mail.com","userId":"dcfxxxxx","status":"unlocked"}', stderr='')

Any ideas? Thanks!

Probably something regarding the output.
I think it isn’t the bw cli tool, since that should be almost identical on windows or Linux, which also leaves out the server it self, since that returns the exact same data no matter which os or client you use.

Since you are using Python, maybe using bitwardentools · PyPI is a better solution.

Seems to be an issue on systems with openssl-3.0 where the default config file is not really backwards compatible. Can you test with OPENSSL_CONF=/dev/null bw list collections if this works as a workaround?

@stefan0xC , thank you!
I was not able to find the issue on GitHub before.

I notice this issue was reported several times at Error cannot decrypt · Issue #3057 · bitwarden/clients · GitHub and the one you mentioned CLI Incompatible with Ubuntu Server 22.04 · Issue #2726 · bitwarden/clients · GitHub.

This trick OPENSSL_CONF=/dev/null bw list collections works for the listing, but I also having problems when edit and create when a collection is defined. And for these two lasts, it does not work.
I have tried using another distro (not Ubuntu) and it works well (like in Windows).

Looks like I will have to run my Python code on the other distribution for now.

BTW, what I am building is a mirror from my KeePass to Vaultwarden.