Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Windows/WSL2 authState race condition causing undefined state crash on Baileys startup #2553

Copy link
Copy link
@LuanValente

Description

@LuanValente
Issue body actions

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.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.