Can't run 'bw list items' in bitwarden-cli because lock file is already being held

I am running a script to acquire my vault data and do some merging on them.

Using the bitwarden-cli, when I run:

bw items list

I get this error:

Error: Lock file is already being held
    at /usr/local/Cellar/bitwarden-cli/2023.12.0/libexec/lib/node_modules/@bitwarden/cli/node_modules/proper-lockfile/lib/lockfile.js:68:47
    at callback (/usr/local/Cellar/bitwarden-cli/2023.12.0/libexec/lib/node_modules/@bitwarden/cli/node_modules/graceful-fs/polyfills.js:306:20)
    at FSReqCallback.oncomplete (node:fs:202:5) {
  code: 'ELOCKED',
  file: '/Users/ian.gallina/Library/Application Support/Bitwarden CLI/data.json'

After some research, I closed everything on macOS that could be using the vault, like Chrome extension, safari extension etc.
And the weird part is, I will not paste the full response here because my data is all there, but it starts to list the items and halfway through it stops.
I am not familiar with the dynamics of the lockfile, but I wondered if the file couldn’t be opened at all.

This is what I get in the middle of the listing process.

                return callback(Object.assign(new Error('Lock file is already being held'), { code: 'ELOCKED', file }));

Hi @Ian_Gallina and welcome to the community :tada:

This has been reported on Github with BUG: CLI list item error · Issue #7126 · bitwarden/clients · GitHub and the team is looking into cause and a potential fix provided by a community member.

If you have any further information, please add that to the Github ticket.

Kind regards,

1 Like