Fix "Invalid folder" error when client sends empty folderId string #51

Closed
opened 2026-04-05 20:29:10 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @mango766 on 3/18/2026

Newer Bitwarden client versions (browser extension v2026.2.0+) send folderId: "" instead of folderId: null when "No folder" is selected. This causes the folder validation at ciphers.rs:451 to attempt a database lookup with an empty string, which naturally fails and returns "Invalid folder" — preventing users from saving credentials entirely.

As identified by @stefan0xC in the issue thread, this is because the Option<FolderId> deserialization treats "" as Some(FolderId("")) rather than None, so the validation code tries to look up a folder with an empty UUID.

This PR normalizes empty folderId values to None at all three places where folder validation occurs:

  • update_cipher_from_data (create/update cipher)
  • put_cipher_partial (update cipher details)
  • move_cipher_selected (move ciphers to folder)

The normalization uses Option::filter to convert Some(FolderId(""))None before validation, and the normalized value is also passed to move_to_folder so the downstream logic is consistent.

Fixes #6962

*Originally created by @mango766 on 3/18/2026* Newer Bitwarden client versions (browser extension v2026.2.0+) send `folderId: ""` instead of `folderId: null` when "No folder" is selected. This causes the folder validation at `ciphers.rs:451` to attempt a database lookup with an empty string, which naturally fails and returns "Invalid folder" — preventing users from saving credentials entirely. As identified by @stefan0xC in the issue thread, this is because the `Option<FolderId>` deserialization treats `""` as `Some(FolderId(""))` rather than `None`, so the validation code tries to look up a folder with an empty UUID. This PR normalizes empty `folderId` values to `None` at all three places where folder validation occurs: - `update_cipher_from_data` (create/update cipher) - `put_cipher_partial` (update cipher details) - `move_cipher_selected` (move ciphers to folder) The normalization uses `Option::filter` to convert `Some(FolderId(""))` → `None` before validation, and the normalized value is also passed to `move_to_folder` so the downstream logic is consistent. Fixes #6962
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/vaultwarden#51