I have been using Bitwarden CLI for multiple years, with similar logic and process using bash at first and lately a python verson. I use cloud and self-hosted instances and I run a script to move items not associated to an organization to the organization and I also execute a full export for backup purposes. I execute for each user account in each instance. I then do an export using the Owner accunt for backup purposes.
What appears to be happening starting just today is that a simple call to list organizations comes back blank at times, specifically for the Owner account.
Command: ./bw list organizations --session $BW_SESSION
For three “standard” accounts in the organization it works flawlessly as always. For the Owner account it returns a blank Organizations list 8 times out of 10.
The generic logic in my script (a portion of it) for each account in the Organization:
List the organizations
Extract the Organization ID
List the collections for the extracted Organization ID
Move any items in the vault not associated with the Organization to the Organization using a pre-defined Collection for each account
For the Organization Owner account, execute a ./bw sync followed by a ./bw export for backups.
I’ve been using these commands for quite a while, this is the first time I’ve seen this behavior. Any ideas?
I introduced a 60 second delay between sets of operations across the accounts and instances and I was able to see the owner account Organization list on the cloud instance correctly twice in a row. I also recalled that earlier I did see the behavior on a non-Owner account, but less consistently than on the Owner account. So maybe it’s not limited to the Owner account of an Organization. It may be the pace of the operations that’s impacting the results. Putting a delay between the logout of one account in an instance and the login to the next may be the thing thai is helping. Still experimenting.
For now I am going to declare victory on this. Repeated runs with a delay of 60 seconds between “sets” of oeprations across Bitwarden instances (self-hosted and cloud) have been successful. I can’t be sure if pace of operations has been tightened a bit on the Bitwarden server side, of if just a temporary anomaly. I’ll wait to see if it recurs.
By the way, I was using CLI version 1.22.0. Just now updated to 1.22.1. Not sure if it matters for my case.
It’s back…can happen on any account, but very consistently for the Owner account for an Organization. Bitwarden CLI, latest version (Nov 2024) - and also tried an earlier version, same result. One out of 20 times it will return Organization ID and Collections lists. Retries with pauses don’t seem to help. But randomly it will run correctly.