evolution-api icon indicating copy to clipboard operation
evolution-api copied to clipboard

Pairing code login fails to receive message events (401/device_removed even with realistic fingerprint)

Open hehuanju opened this issue 1 month ago • 10 comments

Welcome!

  • [x] Yes, I have searched for similar issues on GitHub and found none.

What did you do?

Summary

  • QR code login works normally: connection opens, messages.upsert events fire, and webhooks arrive.
  • Pairing code (8 digits) connects, but soon drops with statusCode: 401, device_removed, and no events.
  • Even after applying a realistic browser fingerprint (Chrome,Chrome,10.0.22631 / Windows 11), the issue persists.

Context

  • Repository: EvolutionAPI/evolution-api
  • Environment: Local Docker Compose (docker-compose.dev.yaml)
  • Provider: Baileys
  • Base version: main branch (commit from 2025-11-11)
  • Host OS: Windows 11 + WSL2 (Ubuntu 22.04)

Steps to Reproduce

  1. Clear sessions/ and volumes (docker-compose down -v).
  2. Start the stack with docker-compose -f docker-compose.dev.yaml up -d --build.
  3. Create an instance via API: POST /instance/create.
  4. Request pairing code: POST /instance/{instanceName}/requestCode with phone filled.
  5. Enter the 8-digit code on WhatsApp (Android or iOS).
  6. Watch the evolution-api container logs.

Expected Behavior

  • Instance remains with connectionState: OPEN.
  • messages.upsert, chats.upsert, and related events fire.
  • Webhooks fire according to configuration.

Actual Behavior

  • Pairing code appears quickly, but the device fails to link after entering it.
  • Logs show:
    2025-11-11T10:41:32Z connection.update -> state: open
    2025-11-11T10:41:42Z connection.update -> state: close, statusCode: 401, type: device_removed
    2025-11-11T10:41:42Z error in validating connection -> Timed Out
    
  • No message events are received; webhook remains silent.
  • QR code login on the same instance works fine.

Attempts So Far

  • ✅ V1: ensure browserOptions is always set in createClient, for both QR and pairing flows.
  • ✅ V2: replace os.release() with a realistic fingerprint (Windows 11, Chrome) and support CONFIG_SESSION_PHONE_CLIENT/NAME/OS.
  • Redeployed with docker compose build --no-cache and helper scripts (deploy-v2-fix.ps1, deploy-fix.sh).
  • Removed old volumes, cleared Baileys cache.
  • Tested on two different devices (Android 14, iOS 17).

Notes

  • Before V1, pairing code logins didn’t receive events but didn’t drop with device_removed.
  • After V1/V2, the code is delivered faster, but the session closes soon after authentication.
  • Appears WhatsApp detects a mismatch between pairing and QR flows or rejects the forced fingerprint.

Request

  • Looking for guidance on a fingerprint closer to the official behavior or additional parameters needed for pairing.
  • Are there known differences in Baileys auth between QR and pairing that we should adjust?
  • Is there an upstream patch/flag addressing 8-digit pairing?

Relevant Logs

[DEBUG] waInstance: browser -> Chrome,Chrome,10.0.22631
[INFO ] connection.update -> {"connection":"open"}
[WARN ] connection.update -> {"connection":"close","lastDisconnect":{"error":{"statusCode":401,"data":"Unauthorized","type":"device_removed"}}}
[ERROR] error in validating connection -> Timed Out

What did you expect?

I expected the 8-digit pairing code login to behave exactly like QR code scanning—for example, normal message event notifications and a comparable login success rate.

What did you observe instead of what you expected?

Right now, QR code login works perfectly, but using the 8-digit code yields no messages and no webhook event notifications. Even when I try to fetch messages manually, I don’t receive any new ones

Screenshots/Videos

No response

Which version of the API are you using?

2.3.6

What is your environment?

Windows

Other environment specifications

No response

If applicable, paste the log output

No response

Additional Notes

No response

hehuanju avatar Nov 11 '25 16:11 hehuanju

+1

VitorS0uza avatar Nov 11 '25 17:11 VitorS0uza

PT-BR: Aqui está ocorrendo o mesmo tanto com o whatsapp normal quanto o business. Se a conta ja estava sincronizada a mais de 10 dias esta rodando normal, mas se desconectar e tentar conectar novamente o mesmo erro começa a ocorrer.

EN: The same thing is happening here, both with regular WhatsApp and WhatsApp Business. If the account has been synchronized for more than 10 days, it works normally, but if you disconnect and try to connect again, the same error starts to occur.

kawhedorgy avatar Nov 11 '25 19:11 kawhedorgy

I still can connect with an iphone but not with android. 2.3.2 and 1.8.6 the same.

DumahBrazorf avatar Nov 12 '25 16:11 DumahBrazorf

+1

savinnsk avatar Nov 12 '25 19:11 savinnsk

Getting a similar error, but with QR Code too. After connecting, the instance will work normally for about 1 and a half minute on average, then disconnect with:

{"level":50,"time":1762974155762,"pid":171274,"hostname":"LAPTOP-EONJ18PO","node":{"tag":"stream:error","attrs":{"code":"401"},"content":[{"tag":"conflict","attrs":{"type":"device_removed"}}]},"msg":"stream errored out"}
[Evolution API]    v6.5.1  171274   -  Wed Nov 12 2025 16:02:35     WARN   [WAMonitoringService]  [string]  Instance "inbox-3-1762974084" - LOGOUT

I tried connecting with Evolution only (no other devices connected to that phone number) but it still disconnects. Haven't tried on business tho.

Davi-AMF avatar Nov 12 '25 19:11 Davi-AMF

+1

ARMCardoso avatar Nov 12 '25 19:11 ARMCardoso

+1

marcelongf avatar Nov 12 '25 23:11 marcelongf

Projeto parece sem atencão.... existe alguma alternativa?

rdelphino avatar Nov 13 '25 01:11 rdelphino

Eu acho que é alguma segurança nova do whatsapp.

Tem um workaround mas pro cliente final é complicado fazer isso: Faz a conexão, espera 3 segundos e depois fecha o whatsapp(fecha totalmente)

English: Its probably a security measurer on whatsapp.

Theres a workaround, if you connect the QR wait for 3 seconds then close the whatsapp, the final whatsapp check doesnt work and the instance keeps connected.

asuma312 avatar Nov 13 '25 12:11 asuma312

Eu acho que é alguma segurança nova do whatsapp.

Tem um workaround mas pro cliente final é complicado fazer isso: Faz a conexão, espera 3 segundos e depois fecha o whatsapp(fecha totalmente)

English: Its probably a security measurer on whatsapp.

Theres a workaround, if you connect the QR wait for 3 seconds then close the whatsapp, the final whatsapp check doesnt work and the instance keeps connected.

Sending messages doesn't work

dkydivyansh avatar Nov 13 '25 14:11 dkydivyansh