Skip to content

[Bug]: MCP createUserDataDir writes profile data to PLAYWRIGHT_BROWSERS_PATH, fails when path is read-only #40892

@Jozef833

Description

@Jozef833

Version

1.59.1 (also present in 1.60.0)

Steps to reproduce

  1. Clone https://github.com/Jozef833/playwright-mcp-bug-repro
  2. npm install
  3. npm run reproduce
  4. You should see Error: EACCES: permission denied, mkdir '<PLAYWRIGHT_BROWSERS_PATH>/mcp-chrome-for-testing-<hash>'

Expected behavior

The MCP server should launch a browser and navigate to the requested URL.

Actual behavior

The MCP server fails with:
Error: EACCES: permission denied, mkdir '<PLAYWRIGHT_BROWSERS_PATH>/mcp-chrome-for-testing-<hash>'

Additional context

createUserDataDir creates browser profile directories inside registryDirectory, which resolves to PLAYWRIGHT_BROWSERS_PATH when that env var is set. Without it, registryDirectory defaults to defaultRegistryDirectory ($XDG_CACHE_HOME/ms-playwright or ~/.cache/ms-playwright), which is writable and works correctly.

This means any environment where PLAYWRIGHT_BROWSERS_PATH points to a read-only location will fail: NixOS (immutable Nix store), read-only Docker mounts, shared filesystem browser caches, etc. The nixpkgs playwright-mcp wrapper is one such case.

The only current workaround is PWMCP_PROFILES_DIR_FOR_TEST, which is only referenced in browserFactory.ts and tests/fixtures.ts.

Environment

System:
  OS: Linux 6.6.114.1-microsoft-standard-WSL2, NixOS 26.05 (Yarara)
  CPU: (32) x86_64
Binaries:
  Node: v24.14.1
Packages:
  playwright-core: 1.59.1
  playwright-mcp: 0.0.69 (via nixpkgs)

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