MCP server crashes when downloading files with persistent profile on Windows · Issue #42831 · microsoft/playwright · GitHub
Skip to content

MCP server crashes when downloading files with persistent profile on Windows #42831

Closed

Description

@zhigangliu-bot

Environment:

  • OS: Windows 10 Enterprise
  • Node.js: v22.x
  • @playwright/mcp: latest (v0.0.81)
  • Claude Code (VSCode extension)

Description:
When using Playwright MCP with a persistent profile (default behavior), any file download operation causes the MCP server to crash with error MCP error -32000: Connection closed.

Steps to reproduce:

  1. Install Playwright MCP via Claude Code: claude mcp add playwright npx @playwright/mcp@latest
  2. Navigate to any website with a download button (e.g., Moka HR system's interview recording download)
  3. Click the download button (either programmatically or manually in the opened browser)
  4. Observe the MCP server crashes with MCP error -32000: Connection closed

Expected behavior:
The download should complete successfully without crashing the MCP server.

Actual behavior:

  • MCP server process exits when download starts
  • The file is still downloaded successfully to ~/Downloads/
  • MCP connection is lost, requiring reconnect

Workaround:
We currently handle this by:

  1. Accepting the crash as expected behavior
  2. Finding the downloaded file (often with .tmp extension) in ~/Downloads/
  3. Waiting for MCP to reconnect automatically
  4. Continuing the workflow

Additional context:

  • This happens with any download operation, not just specific websites
  • The download itself completes successfully; only the MCP server crashes
  • This seems related to how Playwright MCP handles download events with persistent profiles
  • Non-persistent profiles may not have this issue, but we need persistent profiles to maintain login state

Related issues:

Activity

  1. zhigangliu-bot commented on Sep 16, 2026

    @zhigangliu-bot
    Author

    Update: Root Cause Identified

    After further testing, I found the root cause is accumulated profile state rather than a fundamental bug in Playwright MCP.

    Investigation Results

    1. Crash dump files found: 8 crash dump files in %LOCALAPPDATA%\ms-playwright-mcp\mcp-chrome-xxx\Crashpad\reports\

    2. Timeline analysis:

      • Downloads worked fine in the morning and early afternoon
      • First crash occurred at 18:46 (after hours of usage)
      • Subsequent downloads all triggered crashes
      • Files were still downloaded successfully despite the crash
    3. Solution that worked: Deleting the entire ms-playwright-mcp directory:

      rm -rf "%LOCALAPPDATA%\ms-playwright-mcp"

      After this, downloads work normally without crashes.

    Root Cause

    The persistent profile accumulates state over time (crash reports, cache, etc.). When this state becomes corrupted or reaches a certain threshold, it triggers crashes during download operations.

    Suggested Improvements for Playwright MCP

    1. Periodic cleanup: Auto-cleanup of old crash reports and cache files
    2. Download isolation: Better isolation for download operations to prevent profile corruption
    3. Better error handling: More graceful handling of download events with persistent profiles

    Workaround for Users

    If you encounter this issue, try deleting the ms-playwright-mcp directory to reset the profile state. Note that you'll need to re-login to websites after this.

  2. zhigangliu-bot commented on Sep 16, 2026

    @zhigangliu-bot
    Author

    Further Testing: Crash Reports Not the Cause

    I tried deleting the crash reports directory:

    %LOCALAPPDATA%\ms-playwright-mcp\mcp-chrome-xxx\Crashpad\reports\
    

    The crash still happens. This confirms the issue is not caused by accumulated crash reports.

    Additional Finding

    The crash occurs even when manually clicking the download button in the Playwright-opened browser. This means the issue is not with Playwright MCP tool calls, but with the browser instance itself when handling downloads.

    Workaround

    The file is still downloaded successfully to ~/Downloads/ (usually as a .tmp file) despite the crash. We can:

    1. Accept the crash
    2. Find the downloaded .tmp file
    3. Rename and use it

    The crash is annoying but doesn't prevent the download from completing.

  3. zhigangliu-bot commented on Sep 16, 2026

    @zhigangliu-bot
    Author

    Solution Found: Delete the Entire Profile Directory

    After extensive testing, I found the solution:

    What Works

    Deleting the entire ms-playwright-mcp directory:

    rm -rf "%LOCALAPPDATA%\ms-playwright-mcp"

    After this, downloads work normally without crashes. I tested downloading twice in a row - both succeeded without crashes.

    What Doesn't Work

    • Deleting only Crashpad\reports\ directory - crashes still happen
    • The crash reports themselves are not the root cause

    Root Cause

    The issue is caused by accumulated state in the persistent profile directory. Something in the profile (not just crash reports) becomes corrupted or reaches a problematic state that triggers crashes during downloads.

    Recommendation for Users

    If you encounter download crashes with Playwright MCP:

    1. Close the browser
    2. Delete %LOCALAPPDATA%\ms-playwright-mcp (Windows) or ~/.playwright-mcp (Linux/macOS)
    3. Reopen the browser (you'll need to re-login to websites)

    Suggested Fix for Playwright MCP

    Consider implementing:

    1. Automatic cleanup of old profile data
    2. Better isolation for download operations
    3. Profile health checks before starting a session
  4. zhigangliu-bot commented on Sep 16, 2026

    @zhigangliu-bot
    Author

    Critical Finding: Profile State After Browser Close Triggers Crash

    I discovered the exact trigger:

    Steps to Reproduce

    1. Delete the entire ms-playwright-mcp directory
    2. Open browser → Download works fine (tested twice, no crash)
    3. Close browser
    4. Reopen browser → Download crashes

    What This Means

    The issue is triggered by something that happens during browser shutdown:

    • When the browser closes, Chrome saves some state to the profile
    • When reopened, this saved state causes the download operation to crash

    Workaround Options

    1. Keep browser open - Don't close the browser between downloads
    2. Delete profile before each session - Not practical but works
    3. Accept the crash - Files still download successfully to ~/Downloads/

    Possible Root Cause

    Something in the browser shutdown sequence corrupts or sets a state that breaks download handling when the browser restarts with a persistent profile. This could be:

    • A pending download state
    • Crash report metadata
    • Cache or temp file references

    This is a bug in how Playwright MCP handles persistent profile lifecycle on Windows.

  5. zhigangliu-bot commented on Sep 17, 2026

    @zhigangliu-bot
    Author

    Summary and Request for Official Response

    Problem Summary

    This is a critical issue affecting Windows users who need persistent profiles to maintain login states. The issue:

    • ✅ Reproducible: Browser close → reopen → download = crash
    • ✅ Not intermittent: Happens every time after browser restart
    • ✅ Blocks workflows: Prevents seamless automation when downloads are needed

    Current Workarounds

    1. Keep browser open - Not always practical for long-running workflows
    2. Delete profile directory - Requires re-login to all websites
    3. Accept crash - Files download successfully, but workflow is disrupted

    Investigation Findings

    Based on extensive testing:

    1. Root cause: Something in the browser shutdown sequence corrupts or sets a state that breaks download handling when the browser restarts
    2. Not caused by: Crash reports accumulation, cache size, or specific websites
    3. Trigger: Specifically tied to persistent profile state after browser close

    Questions for Maintainers

    1. Is this a known limitation of persistent profiles on Windows?
    2. Are there plans to fix this issue?
    3. Would it help if I provided:
      • Chrome DevTools protocol logs during the crash?
      • Profile directory comparison (fresh vs. after close)?
      • Browser console logs?

    Suggested Fixes

    Possible approaches that could help:

    • Clear download-related state on browser shutdown
    • Better isolation for download operations with persistent profiles
    • Profile health checks before starting a session
    • Option to exclude download state from profile persistence

    This issue significantly impacts the usability of Playwright MCP for production workflows on Windows. Any guidance or fix would be greatly appreciated!

  6. github-actions commented on Sep 21, 2026

    @github-actions
    Contributor

    Hi, I'm the Playwright bot and I took a first look at this on Windows.

    Couldn't reproduce the crash. On a Windows runner with real Chrome and the default persistent profile, I ran your exact trigger — download, close the browser, reopen, download again — on @playwright/mcp 0.0.81 (the version you reported) and 0.0.82, headed and headless. The download completed and the MCP server stayed up every time.

    One detail in your report points somewhere useful though: you say the file lands in ~/Downloads, often as a .tmp. When the MCP server handles a download, Playwright intercepts it and saves it into the MCP output dir — in my runs it was .playwright-mcp\hello.txt, never ~/Downloads. A file in ~/Downloads means Chrome's own download manager wrote it, i.e. the download was never handed to Playwright. Combined with the Crashpad dumps you found, that reads as the Chrome process itself dying, with MCP error -32000: Connection closed being the downstream symptom rather than the cause.

    So the two questions I'd need answered to get further:

    1. Are you pointing the MCP server at your own Chrome — --browser chrome against an existing profile, the browser extension, or a CDP endpoint — rather than letting it launch its own persistent profile? That would explain downloads going to ~/Downloads.
    2. Could you attach one of the .dmp files from %LOCALAPPDATA%\ms-playwright-mcp\mcp-chrome-*\Crashpad\reports\, plus the MCP server's stderr with DEBUG=pw:browser* set? The dump will say whether Chrome crashed on its own.
    What I ran
    • OS: Windows (GitHub Actions windows-latest), Node v24.20.0, Google Chrome from C:\Program Files\Google\Chrome\Application\chrome.exe
    • versions: @playwright/mcp@0.0.81 (as reported) and @playwright/mcp@0.0.82
    • driven over stdio with a minimal MCP client, default persistent profile at %LOCALAPPDATA%\ms-playwright-mcp (confirmed created and reused)
    • scenarios:
      • fresh profile → download → server alive
      • close browser → reopen with the same profile → download → server alive (your reported trigger)
      • headed and headless, both of the above
      • forced a failing download write via --output-dir pointing at a non-directory: both 0.0.81 and 0.0.82 surfaced ENOTDIR as a normal tool error and the server stayed up — so a failed saveAs isn't taking the process down either
    • download trigger: local HTTP endpoint returning Content-Disposition: attachment
    • in every run the file was saved to .playwright-mcp\hello.txt, not ~/Downloads

    I'm a first pass, not the final word here — a crash dump would settle it quickly.

    Triaged on Windows by the Playwright bot - agent run

  7. added a commit that references this issue on Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions