Problem
While running Evolution API v2.3.7 on Windows + WSL2 + Docker Desktop environments, the application randomly crashes during WhatsApp instance initialization with:
TypeError: Cannot read properties of undefined (reading 'state')
The issue happens inside:
this.instance.authState.state.creds
Environment
- Windows 11
- WSL2
- Docker Desktop
- Evolution API 2.3.7
- Baileys
Symptoms
- QR code loop
- disconnected status
- timeout on connect
- reconnect loop
- instance closes immediately after creation
Root Cause
A race condition during socket bootstrap allows the Baileys client to initialize before authState is fully initialized.
Fix
I created a defensive fallback validation before accessing:
this.instance.authState.state
This prevents crashes during early bootstrap on slower/containerized Windows environments.
Repository
Fix implementation and documentation:
https://github.com/LuanValente/evolution-api-wsl2-authstate-fix
Author
Developed and documented by:
Luan Valente
Credits
This repository is based on the original Evolution API project:
https://github.com/EvolutionAPI/evolution-api
All credits for the original implementation belong to the Evolution API maintainers.
Problem
While running Evolution API
v2.3.7on Windows + WSL2 + Docker Desktop environments, the application randomly crashes during WhatsApp instance initialization with:The issue happens inside:
Environment
Symptoms
Root Cause
A race condition during socket bootstrap allows the Baileys client to initialize before
authStateis fully initialized.Fix
I created a defensive fallback validation before accessing:
This prevents crashes during early bootstrap on slower/containerized Windows environments.
Repository
Fix implementation and documentation:
https://github.com/LuanValente/evolution-api-wsl2-authstate-fix
Author
Developed and documented by:
Luan Valente
Credits
This repository is based on the original Evolution API project:
https://github.com/EvolutionAPI/evolution-api
All credits for the original implementation belong to the Evolution API maintainers.