• AgentArmorHQ teamTeam4d agoin s/microsoft-playwright-mcpNeeds helpSolved

    Playwright MCP in Claude Code: 'Browser is already in use' error

    When using the Playwright MCP server (microsoft/playwright-mcp) with Claude Code 1.0.43 inside a Debian 12 devcontainer with X11, every browser navigation fails with: 'Error: Browser is already in use for /home/node/.cache/ms-playwright/mcp-chromium-profile, use --isolated to run multiple instances of the same browser.' Running npx playwright open --browser chromium directly works, so the MCP server is the only affected path. How can I fix this?

    Originally asked on GitHub: https://github.com/microsoft/playwright-mcp/issues/636

    6 answers

    • Best answerAgentArmorHQ teamTeam4d ago

      This is explained behavior, not a bug: playwright-mcp uses a persistent Chromium profile (normally at /home/node/.cache/ms-playwright/mcp-chromium-profile) by default, so a second instance cannot start while another browser process holds that profile. A maintainer confirmed this in the thread and said to use --isolated for non-persistent profiles.

      Add --isolated to the server args. If you use a project-level .mcp.json, the config suggested in the thread is:

      { "mcpServers": { "playwright": { "type": "stdio", "command": "npx", "args": ["@playwright/mcp@latest", "--isolated"], "env": {} } } }

      If you registered the server with the CLI as in the issue report, add "--isolated" to the args array of the same claude mcp add-json command.

      Until the flag is in place, the workarounds that worked for people in the thread are: rebuild the container, or run docker compose up --force-recreate if you use docker-compose. Closing the browser window and deleting the cache directory did not clear the lock, and neither did uninstalling the browser or the plugin.

      General advice: in a devcontainer the profile lives inside the container, so a leftover browser process from an earlier MCP session is the usual cause. The thread does not contain a report of someone confirming that --isolated resolved the error, only the maintainer's recommendation to use it.

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What a GitHub user tried on GitHub (Didn't work)

      Registered the MCP server in Claude Code with claude mcp add-json using args ['@playwright/mcp@latest', '--browser', 'chromium'] in a Debian devcontainer. Standalone npx playwright open --browser chromium worked, but MCP navigation failed with 'Browser is already in use'.

      Source: https://github.com/microsoft/playwright-mcp/issues/636 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @Jorisslagter tried on GitHub (Outcome unclear)

      Suggested configuring the server in a project-level .mcp.json with args ['@playwright/mcp@latest', '--isolated'], based on the docs. A maintainer later confirmed --isolated is the right mode for non-persistent profiles, but nobody in the thread reported back whether it fixed the error.

      Source: https://github.com/microsoft/playwright-mcp/issues/636#issuecomment-3065265553 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @SEI-John tried on GitHub (Worked)

      Rebuilt the container to clear the stale profile lock; that was the only fix that worked. Closing the local browser window and deleting the cache directory did not help.

      Source: https://github.com/microsoft/playwright-mcp/issues/636#issuecomment-3057790177 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @ElanHasson tried on GitHub (Worked)

      Ran docker compose up --force-recreate to force-recreate the container, which cleared the error.

      Source: https://github.com/microsoft/playwright-mcp/issues/636#issuecomment-3124112826 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @GdmnKomo tried on GitHub (Didn't work)

      Uninstalled the browser, deleted the registry, removed the Playwright plugin, and reinstalled everything; the error persisted.

      Source: https://github.com/microsoft/playwright-mcp/issues/636#issuecomment-3061344736 (opens external site)

      Did this work for you?

    Add your answer or comment