From 5dac1a5f649d8d88f3175b53ad4d85e14b33489e Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 6 Feb 2026 21:50:36 +0000 Subject: [PATCH] fix(carousel): skip own linked devices to prevent error 479 Debug logging revealed that error 479 comes exclusively from the sender's own linked devices (WhatsApp Web/Desktop) when they receive the carousel wrapped in deviceSentMessage (DSM). Recipient devices receive the raw carousel (without DSM) and process it correctly. The fix skips sending carousel to sender's own linked devices: - Skip meRecipients (own devices) when message is carousel - Skip DSM wrapper in createParticipantNodes for carousel - Skip DSM in retry path for own devices when carousel The carousel still renders correctly on: - Sender's phone (initiator) - All recipient devices (phone + Web/Desktop) https://claude.ai/code/session_01EK9NpViRCtda1WAvFd8ptR --- src/Socket/messages-send.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Socket/messages-send.ts b/src/Socket/messages-send.ts index adefe441..484c9da2 100644 --- a/src/Socket/messages-send.ts +++ b/src/Socket/messages-send.ts @@ -1163,6 +1163,9 @@ export const makeMessagesSocket = (config: SocketConfig) => { const { user: mePnUser } = jidDecode(meId)! const { user: meLidUser } = meLid ? jidDecode(meLid)! : { user: null } + // Detect carousel to skip own devices (they can't handle carousel in DSM wrapper) + const isCarouselForDSM = isCarouselMessage(message) + for (const { user, jid } of devices) { const isExactSenderDevice = jid === meId || (meLid && jid === meLid) if (isExactSenderDevice) { @@ -1174,6 +1177,11 @@ export const makeMessagesSocket = (config: SocketConfig) => { const isMe = user === mePnUser || user === meLidUser if (isMe) { + // Skip own linked devices for carousel - they reject DSM-wrapped carousel with error 479 + if (isCarouselForDSM) { + logger.debug({ jid }, '[CAROUSEL] Skipping own linked device - carousel DSM not supported') + continue + } meRecipients.push(jid) } else { otherRecipients.push(jid) @@ -1189,8 +1197,9 @@ export const makeMessagesSocket = (config: SocketConfig) => { { nodes: otherNodes, shouldIncludeDeviceIdentity: s2 } ] = await Promise.all([ // For own devices: use DSM if available (1:1 chats only) + // Skip for carousel - linked devices can't handle carousel in DSM wrapper (error 479) createParticipantNodes(meRecipients, meMsg || message, extraAttrs), - createParticipantNodes(otherRecipients, message, extraAttrs, meMsg) + createParticipantNodes(otherRecipients, message, extraAttrs, isCarouselForDSM ? undefined : meMsg) ]) participants.push(...meNodes) participants.push(...otherNodes) @@ -1208,7 +1217,10 @@ export const makeMessagesSocket = (config: SocketConfig) => { const isParticipantLid = isLidUser(participant!.jid) const isMe = areJidsSameUser(participant!.jid, isParticipantLid ? meLid : meId) - const encodedMessageToSend = isMe + // Skip DSM for carousel retries to own devices - they can't handle it + const isCarouselRetry = isCarouselMessage(message) + const usesDSM = isMe && !isCarouselRetry + const encodedMessageToSend = usesDSM ? encodeWAMessage({ deviceSentMessage: { destinationJid,