Repository navigation
fix(provider-baileys): honor the manual WA version and recover from 405 - #1296
Merged
Merged
Conversation
The `version` option was spread after the resolved version, so a stale value
from the starter template reached the socket and WhatsApp rejected it (405)
while the log claimed the live version was in use.
- Resolve the version manual (WA_VERSION, then `version`) -> Baileys-recommended
-> live WhatsApp Web -> bundled, each lookup bounded by a 5 s timeout. Baileys
lookups never throw, so their `error` field now drives the fallback.
- Accept the version as copied from wppconnect.io ('2.3000.x-alpha').
- On 405, reconnect with the live WhatsApp Web version (up to 3 times), then
emit auth_failure explaining the manual fix.
- Log the version source in baileys.log.
Co-authored-by: Cursor <cursoragent@cursor.com>
[2, 3000, 1035824857] is rejected by WhatsApp with 405. The version is now resolved automatically; the comment keeps the manual fix (wppconnect.io version or WA_VERSION) for emergencies. Co-authored-by: Cursor <cursoragent@cursor.com>
This was referenced Nov 18, 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.
Summary
Bots created from the baileys starters failed with
405 Connection Failure. The starter template passed{ version: [2, 3000, 1035824857] }, and...this.globalVendorArgswas spread after the resolved version,so that stale value reached the socket.
baileys.logstill printed "Using live WA Web version", which hid thecause.
Tested against WhatsApp today with a fresh auth state per run:
[2, 3000, 1035824857](old template)[2, 3000, 1043857760](Baileys recommended / bundled)[2, 3000, 1055185710](live WhatsApp Web)Changes
@builderbot/provider-baileyssrc/waVersion.tsresolves the version in this order: manual (WA_VERSIONenv, then theversionoption),then the Baileys-recommended version, then live WhatsApp Web, then the bundled one. Each lookup has a 5 s timeout.
Baileys lookups never throw (they return the bundled version with
errorset), so the oldtry/catchchain neverreached its fallbacks; the
errorfield now drives them.versionaccepts the text copied from https://wppconnect.io/whatsapp-versions/ ('2.3000.1054953954-alpha').that it emits
auth_failureexplaining the manual fix.baileys.logrecords the source:Using WA Web version 2.3000.x (source: baileys).Starters (generated with
pnpm run generate.templates)createProvider(Provider). The comment keeps the manual fix (wppconnect version orWA_VERSION).Test plan
provider-baileys: 279 tests pass, including newwaVersion.test.tsand 405 / manual-version cases inlifecycle.test.tspnpm testacross the monorepo (pre-push)pnpm --filter @builderbot/provider-baileys buildTemplates in sync(not run locally: on Windows it rewrites every starter with LF/CRLF noise)Follow-up
provider-sherpahas the same problem: its template version (1034028152) and its fallback (1023223821) both get405 today. That goes in a separate PR.