Skip to content

RemoteAuth may leave orphan .zip or temp dirs. on crash #3724

@Adi1231234

Description

@Adi1231234

Is there an existing issue for this?

  • I have searched the existing issues.

Is this a problem caused by your code, or is it specifically because of the library?

  • I have double-checked my code carefully.

Describe the bug.

When using RemoteAuth, if the process crashes (e.g., power loss, forced quit) while storeRemoteSession() is running, it may leave behind orphan artifacts:

  • A half-written ${sessionName}.zip (created in compressSession()), which can later cause unzip errors.
  • wwebjs_temp_session_ directories that are copied but never deleted.

These files are not automatically cleaned up, and can cause corrupted restores or disk bloat over time.

Expected Behavior

The .zip should either be fully written or not present at all (atomic write).
Temporary folders should be cleaned up on crash/restart.
On startup, RemoteAuth should ignore/delete any old orphaned files before trying to restore.

Steps to Reproduce the Bug or Issue

Initialize a client with RemoteAuth.
Let it run until the first backup sync starts (afterAuthReady → storeRemoteSession()).
Force kill the process (Ctrl+C, SIGKILL, or simulate power loss) while compressSession() is writing the zip.
Restart the process.

WhatsApp Account Type

Standard

Browser Type

Google Chrome

Operation System Type

Windows

Phone OS Type

Android

WhatsApp-Web.js Version

1.32.0

Authentication Strategy

RemoteAuth

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions