Is there a rate limit? In Server, CLI or is it just buggy?

Hey community,

we would like to use bitwarden for shared system passwords - as supposed. Therefore we would like to automatically generate strong passwords and save them into bitwarden by some scripting. As the setup of a new system in our case means we would create tens of entries I’m running into some troubles with the script.

During some tests I can reproduce it very easily with a small loop, in this case I just create a securenote :
for NUM in $(seq 1 70); do
bw get template item | jq “.type=2 | .name=“TestBitwarden #$NUM” | .notes=”$NUM" | .secureNote=$(bw get template item.securenote) " | bw encode | bw create item
done

Per single create it takes somewhat between 1 and 2 seconds, so my expectation would be it should finish with 70 entries in ~2 minues.

But it fails somewhere between 20 and 60 entries without any dedicated message:
32 - Fri Sep 10 08:43:17 CEST 2021
{“object”:“item”,“id”:“72627c47-6294-47c1-9530-ad9f006ec709”,“organizationId”:null,“folderId”:null,“type”:2,“reprompt”:0,“name”:“TestBitwarden #32”,“notes”:“32”,“favorite”:false,“secureNote”:{“type”:0},“revisionDate”:“2021-09-10T06:43:19.708Z”}
33 - Fri Sep 10 08:43:19 CEST 2021
You are not logged in.
events.js:353
throw er; // Unhandled ‘error’ event
^

Error: write EPIPE
at afterWriteDispatched (internal/stream_base_commons.js:156:25)
at writeGeneric (internal/stream_base_commons.js:147:3)
at Socket._writeGeneric (net.js:785:11)
at Socket._write (net.js:797:8)
at writeOrBuffer (internal/streams/writable.js:358:12)
at Socket.Writable.write (internal/streams/writable.js:303:10)
at program_Program.writeLn (/snapshot/cli/build/bw.js:26655:20)
at program_Program.processResponse (/snapshot/cli/build/bw.js:27905:22)
at program_Program.processResponse (/snapshot/cli/build/bw.js:28320:15)
at program_Program. (/snapshot/cli/build/bw.js:28223:22)
Emitted ‘error’ event on Socket instance at:
at emitErrorNT (internal/streams/destroy.js:106:8)
at emitErrorCloseNT (internal/streams/destroy.js:74:3)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
errno: -32,
code: ‘EPIPE’,
syscall: ‘write’
}
34 - Fri Sep 10 08:43:20 CEST 2021
Error creating lowdb storage adapter, “Malformed JSON in file: /home/schretzi/.config/Bitwarden CLI/data.json
Unexpected string in JSON at position 36”; emptying data file.
Writing backup of data file to /home/schretzi/.config/Bitwarden CLI/data.json.bak
Error creating lowdb storage adapter, “Malformed JSON in file: /home/schretzi/.config/Bitwarden CLI/data.json
Unexpected string in JSON at position 36”; emptying data file.
Writing backup of data file to /home/schretzi/.config/Bitwarden CLI/data.json.bak
You are not logged in.
You are not logged in.

Anybody here who has seen this or a similar problem?

In the code I found a rate limit for 60 API Calls / min, but for me it looks only the create action is a real API Call to the server and I don’t see how I would create 60 Calls / min in that case.

br
schretzi

Hi @schretzi!

There is a rate limit, but this wouldn’t come anywhere close to it. It seems like something our team would need to look at. It seems like you can reproduce this reliably - would you mind posting this to Issues · bitwarden/cli · GitHub ?