Home/Wiki Errors/Playwright MCP
Playwright MCP / Browser session

Playwright MCP browser closed unexpectedly

The browser process or page target disappeared while the agent expected it to stay controllable.

Error text / 报错原文

  • browser closed
  • Target page, context or browser has been closed
  • Browser closed unexpectedly

What it means

The browser process or page target disappeared while the agent expected it to stay controllable.

Most common causes

  • Shared browser handle was released
  • Headless browser crashed
  • Agent cancelled a command while navigation was active
  • Previous session left stale browser state

Fastest fix

  • Reproduce the smallest failing case outside the agent.
  • Confirm auth, session, and transport before changing app code.
  • Disable unrelated tools or servers and retry once.
  • Capture the exact timestamp, client version, and raw error text.

Safe fix

  • Keep secrets in environment variables or the platform secret store.
  • Use least-privilege scopes and read-only tools by default.
  • Add validation around manifests, schemas, and callback URLs.
  • Document the working local and production configuration.

What not to do

  • Do not paste OAuth tokens or session IDs into public logs.
  • Do not bypass TLS, CSP, or permission prompts as a permanent fix.
  • Do not enable every MCP tool globally just to make one task pass.

Diagnostic commands

node --version
npx @playwright/mcp@latest --help
curl http://127.0.0.1:9222/json/version

Related tools

Related errors

Sources