Repository navigation
fix: use WWebJS.getChat for inviteV4 fallback in addParticipants - #201792
Merged
tuyuribr merged 2 commits intoJul 27, 2026
Merged
Conversation
|
Sweet, this does look like a good fix for the issue I'm having! Thanks! Unfortunately it isn't easy for me to reproduce at-will. This is a flow encountered in a production system with user accounts not under my control. I will report back as soon as I can but I'm looking forward to seeing this merged! |
|
Hey, I wanted to update that this fix works for me. Looking forward to seeing it in main! |
Contributor
Author
great |
|
@BenyFilho Apologies for the mention, but how can I help in getting this merged in? I'm asking because I think I identified another bug I'd like to report |
BenyFilho
requested review from
aliyss,
pedroslopez,
purpshell,
shirser121 and
tuyuribr
July 9, 2026 23:30
aliyss
approved these changes
Jul 27, 2026
tuyuribr
approved these changes
Jul 27, 2026
tuyuribr
enabled auto-merge (squash)
July 27, 2026 17:56
devlikepro
pushed a commit
to devlikeapro/whatsapp-web.js
that referenced
this pull request
Jul 29, 2026
…bjs#201792) Co-authored-by: Aliyss Snow <33941859+aliyss@users.noreply.github.com> (cherry picked from commit 942d236)
developer-ashok
pushed a commit
to developer-ashok/whatsapp-web.js
that referenced
this pull request
Aug 16, 2026
igoreira0
pushed a commit
to Runtime-Consulting/whatsapp-web.js
that referenced
this pull request
Aug 21, 2026
…bjs#201792) Co-authored-by: Aliyss Snow <33941859+aliyss@users.noreply.github.com>
developer-ashok
pushed a commit
to developer-ashok/whatsapp-web.js
that referenced
this pull request
Sep 5, 2026
developer-ashok
pushed a commit
to developer-ashok/whatsapp-web.js
that referenced
this pull request
Sep 9, 2026
3 tasks done
developer-ashok
pushed a commit
to developer-ashok/whatsapp-web.js
that referenced
this pull request
Sep 23, 2026
developer-ashok
pushed a commit
to developer-ashok/whatsapp-web.js
that referenced
this pull request
Sep 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
GroupChat.addParticipantscrashes withTypeError: this.findImpl is not a functionwhen a participant can't be added directly and the inviteV4 fallback kicks in (RPC code 403,ParticipantRequestCodeCanBeSent).The fallback looked up the participant's 1:1 chat via the legacy collection API:
Current WhatsApp Web builds no longer implement
findImplon the Chat collection, so whenever the participant has no existing private chat — which is precisely the scenario where the invite fallback is needed —Chat.getmisses andChat.findthrows.This PR replaces that lookup with the library's own
window.WWebJS.getChat()helper, which was already migrated to WhatsApp's supportedWAWebFindChatAction.findOrCreateLatestChatAPI (#3703) and also creates the chat when it doesn't exist, handling LID/PN resolution. This mirrors howremoveParticipantsin the same file already resolves chats.Note: this call site is the only remaining legacy
Chat.findusage that structurally targets a user with no loaded chat, which is why it's the one crashing in the wild. Migrating the other (practically unreachable) legacy call sites could be a follow-up.Related Issue(s)
fixes #201789
Testing Summary
Test Details
Fix is based on analysis of the stack trace in #201789: the crash originates at the legacy
Chat.findcall, and the replacement (window.WWebJS.getChat) is the same code path already exercised on current WhatsApp Web bygetChatByIdandremoveParticipants.I could not yet reproduce the full scenario end-to-end (it requires a second account with group-add privacy set to "My contacts" and no prior chat with the account). Verification from the issue reporter, who has a reliable repro, would be appreciated.
eslintandprettier --checkpass on the changed file.Unrelated note:
.husky/commit-msguses the GNU-sed-only\Lextension, which on macOS (BSD sed) prepends a literalLto the commit type, making every commit fail commitlint. Can open a separate PR for that.Environment
Type of Change
Checklist
npm test).index.d.ts) have been updated if necessary. (no signature change, not needed)example.js) / documentation have been updated if applicable. (not applicable)