Skip to content

WEBJS session falls back to SCAN_QR_CODE after ProtocolError during media download #2086

@frankkuipersgit

Description

@frankkuipersgit

Summary

A WEBJS session that was previously WORKING fell back to SCAN_QR_CODE after WAHA hit a Chromium/Puppeteer ProtocolError while processing an incoming media message.

The container itself did not restart, was not OOM-killed, and there was no explicit start/stop/logout/restart/auth request from our app around the failure window. WAHA restarted the internal WEBJS engine, but the session came back requiring a QR scan.

Environment

  • Image: devlikeapro/waha-plus:latest
  • WAHA user agent observed in webhook delivery: WAHA/2026.4.3
  • Engine: WEBJS
  • Node inside container: v24.11.1
  • Runtime: Docker
  • Container restart count: 0
  • Container OOM killed: false

Timeline

All timestamps are UTC.

  • 2026-05-20 13:56:54.102 - MediaManager starts downloading media for an incoming message.
  • 2026-05-20 13:56:54.407 - WAHA logs ProtocolError when calling page method: evaluate, restarting client....
  • 2026-05-20 13:56:54.407 - WAHA logs Protocol error (Runtime.callFunctionOn): Execution context was destroyed.
  • 2026-05-20 13:56:56.409 - WAHA logs The browser has been disconnected.
  • WAHA schedules/runs start-engine internally.
  • 2026-05-20 13:57:06.002 - WAHA starts printing QR guidance for the same session.
  • Session status events observed by our webhook: WORKING -> FAILED -> STARTING -> FAILED -> STARTING -> SCAN_QR_CODE.

Redacted Log Excerpt

[13:56:54.102] INFO  (MediaManager): session:[redacted] - The message [redacted] has media, downloading it...
[13:56:54.407] ERROR (WhatsappSession): session:[redacted] - ProtocolError when calling page method: evaluate, restarting client...
[13:56:54.407] ERROR (WhatsappSession): session:[redacted] - Protocol error (Runtime.callFunctionOn): Execution context was destroyed.
      "type": "ProtocolError"
      "message": "Protocol error (Runtime.callFunctionOn): Execution context was destroyed."
      "name": "ProtocolError"
[13:56:54.408] INFO  (WhatsappSession): session:[redacted] - Job scheduled with timeout 2000 ms {"job":"start-engine"}
error: Unhandled Rejection: TargetCloseError: Protocol error (Runtime.callFunctionOn): Target closed
[13:56:56.409] ERROR (WhatsappSession): session:[redacted] - The browser has been disconnected
[13:56:56.416] INFO  (WhatsappSession): session:[redacted] - Using cache type: 'none'
[13:57:00.802] ERROR (WhatsappSession): session:[redacted] - Protocol error (Runtime.callFunctionOn): Execution context was destroyed.
[13:57:02.807] INFO  (WhatsappSession): session:[redacted] - Using cache type: 'none'
[13:57:06.002] INFO  (WhatsappSession): session:[redacted] - You can disable QR in console by setting 'WAHA_PRINT_QR=false' in your environment variables.
[13:57:06.453] ERROR (MediaManager): session:[redacted] - Failed to execute 'Fetching media', tried '5' times
[13:57:06.454] ERROR (MediaManager): session:[redacted] - Error processing media for message '[redacted]'
      Error: Attempted to use detached Frame '[redacted]'.

Expected Behavior

A transient WEBJS/Chromium page crash during media processing should either recover the authenticated session back to WORKING, or fail media processing without invalidating the linked-device auth state.

Actual Behavior

The session moved to SCAN_QR_CODE and required manual QR re-authentication.

Question

Is this a known WEBJS/Puppeteer recovery issue, and is there a recommended mitigation or setting to avoid losing the authenticated session after this class of browser/page crash?

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