> ## Documentation Index
> Fetch the complete documentation index at: https://whatsapp-rust.jlucaso.com/llms.txt
> Use this file to discover all available pages before exploring further.

# June 9, 2026 — Device list: primary device preserved on device-remove

> Fixed a bug where a remove notification targeting device 0 could silently drop the primary from the stored device list, suppressing the usync re-fetch and causing encrypted messages to miss the primary phone.

## Fixes

**Device-remove path now ignores removes for the primary device ([#801](https://github.com/oxidezap/whatsapp-rust/pull/801))**

**The problem.** `patch_device_remove` retained devices by filtering out the given `device_id` with no floor on the list. A remove notification targeting device 0 would delete its sender-key rows and persist a record with no device 0. Because `get_user_devices` treats any existing record as authoritative and only goes to the network when there is no record at all, the broken list would stick and suppress the usync re-fetch forever — the symmetric failure mode to the add-path bug fixed in [#797](https://github.com/oxidezap/whatsapp-rust/pull/797).

The pre-existing `device_id_u16 != 0` guard only skipped *session* cleanup for the primary; it did not prevent the registry removal or the sender-key-row delete.

**The fix.** `patch_device_remove` now returns immediately when `device_id == 0`. WA Web never drops the primary device, so a remove targeting it is treated as a no-op. This mirrors the invariant enforced on the add path since #797.

**Impact.** No API changes. No breaking changes. A device-remove notification for device 0 is an invalid notification that WA Web ignores; handling it as a no-op now matches that behavior.
