Skip to content

[GOWS] getChatMessages returns empty/422 for groups with recent activity #1968

@Seithx

Description

@Seithx

Describe the bug

GET /api/{session}/chats/{chatId}/messages returns 422 Unprocessable Entity or empty results for group chats that have recent activity. This makes catch-up after a session reconnect unreliable -- messages received while the session was down are lost.

The session status reports WORKING, webhooks for new messages work fine, but fetching recent history for the same chat fails.

Version

{
  "version": "2026.3.2",
  "engine": "GOWS",
  "tier": "CORE"
}

Steps to reproduce

  1. Session is WORKING, a group receives messages via webhook normally
  2. Session goes STOPPED (or container restarts)
  3. Session recovers to WORKING
  4. Call GET /api/default/chats/{groupJid}/messages?limit=50
  5. Response: 422 Unprocessable Entity with body:
{
  "error": "Session status is not as expected. Try again later or restart the session",
  "session": "default",
  "status": "STOPPED",
  "expected": ["WORKING"]
}
  1. Even after session is confirmed WORKING again, the same endpoint returns empty or 422 for several groups

Observed behavior

  • Out of 18 monitored groups, 11 consistently fail with 422 on getChatMessages after a session restart
  • Retry 30 seconds later: same 422
  • The groups that fail are the same every time
  • Webhooks for these same groups work immediately after session recovery
  • This makes post-downtime catch-up impossible for affected groups

Expected behavior

getChatMessages should return recent messages for any group the session is a member of, especially after session recovery.

Docker Logs

WARNING: failed to fetch from <groupJid>: Client error '422 Unprocessable Entity'
WARNING: Forward catch-up: failed to fetch from <groupJid>: Client error '422 Unprocessable Entity'
WARNING: Forward catch-up retry: still failing for <groupJid>
INFO: Forward catch-up: no missed messages from <groupJid>

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions