#2158·Baileys

[BUG] Poll votes are not decrypting.

Author: bnsantCreated Dec 8, 2025Updated Sep 9, 2026
Labelsbug

decryptPollVote throws The first argument must be of type string or Buffer … Received undefined even though the poll message is stored and messageContextInfo.messageSecret appears to be present. Votes arrive as pollUpdateMessage, but decryption fails and aggregated voters stay empty.

Create a poll in a group (group uses LID IDs, e.g., ...@lid participants).

Save the poll message in an in-memory store and emit an upsert for it.

On messages.upsert, receive pollUpdateMessage with { pollCreationMessageKey, vote: { encPayload, encIv }, senderTimestampMs }.

Look up the poll by pollCreationMessageKey.id in the store, then call: decryptPollVote(pollUpdateMsg.vote, { pollCreatorJid, pollMsg: pollMsgStored.message, // proto.Message with messageSecret voterJid, }); Observe the error above; votes never aggregate (getAggregateVotesInPollMessage sees 0 voters). Expected behavior decryptPollVote succeeds, votes are aggregated, and voters.length increases so the poll can reach the threshold. Environment (please complete the following information):

Is this on a server? Yes connectOptions: emitOwnEvents: true, getMessage returns messages from an in-memory Map store (saved in messages.upsert and when sending the poll).

Multiple clients on the same IP? No Proxy? No

Additional context:

Groups use LID (participants like ...@lid). Poll message in the store shows keys: ['messageContextInfo', 'pollCreationMessageV3'], and logging indicates messageSecret is present. Full vote handler (upsert): decryption attempt uses pollMsgStored.message (proto.Message) and the poll creator JID from the stored poll key. Even after saving the poll and emitting messages.upsert { messages: [pollMessage], type: 'append' }, the error persists.