"bw edit item" gives an error message "Unknown cipher type."

bw edit folder works just fine but

echo ‘{ “login”: {“username”: “anotherusername”}}’ | bw encode | bw edit item <item_id> throws the error below.

Using macOS High Sierra 10.13.6, bitwarden-cli is installed using brew.

Any ideas?

(node:20603) UnhandledPromiseRejectionWarning: Error: Unknown cipher type.
at CipherService. (/usr/local/Cellar/bitwarden-cli/1.3.0/libexec/lib/node_modules/@bitwarden/cli/build/bw.js:67223:27)
at Generator.next ()
at /usr/local/Cellar/bitwarden-cli/1.3.0/libexec/lib/node_modules/@bitwarden/cli/build/bw.js:66428:71
at new Promise ()
at __awaiter (/usr/local/Cellar/bitwarden-cli/1.3.0/libexec/lib/node_modules/@bitwarden/cli/build/bw.js:66424:12)
at CipherService.encryptCipherData (/usr/local/Cellar/bitwarden-cli/1.3.0/libexec/lib/node_modules/@bitwarden/cli/build/bw.js:67162:16)
at CipherService. (/usr/local/Cellar/bitwarden-cli/1.3.0/libexec/lib/node_modules/@bitwarden/cli/build/bw.js:66547:22)
at Generator.next ()
at fulfilled (/usr/local/Cellar/bitwarden-cli/1.3.0/libexec/lib/node_modules/@bitwarden/cli/build/bw.js:66425:58)
(node:20603) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:20603) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

You’re not providing the full item template for editing. You should get the item first, then make the needed change, encode, and edit.

Ah okay, indeed this worked:

item_id=$(bw get item unique_item_name | jq -r ‘.id’)

bw get item $item_id | jq ‘.login.username = “new_username” | .login.password = “new_password”’ | bw encode | bw edit item $item_id

Thank you very much.