microsoft/playwright · error · Error
Browser userDataDir is not supported in isolated mode.
Error message
Browser userDataDir is not supported in isolated mode.
What it means
Thrown by `validateBrowserConfig` when both `browser.isolated` and `browser.userDataDir` are set. Isolated mode creates a fresh ephemeral context per session, which is incompatible with a fixed userDataDir (a persistent profile); the combination is contradictory and rejected at config validation time.
Source
Thrown at packages/playwright-core/src/tools/mcp/config.ts:235
async function validateBrowserConfig(browser: MergedConfig['browser']): Promise<FullConfig['browser']> {
let browserName = browser.browserName;
if (!browserName) {
browserName = 'chromium';
// Assign channel only if the browserName is not provided, otherwise assume full control to the user.
if (browser.launchOptions.channel === undefined)
browser.launchOptions.channel = 'chrome';
}
if (browserName === 'chromium' && browser.launchOptions.chromiumSandbox === undefined) {
if (process.platform === 'linux')
browser.launchOptions.chromiumSandbox = browser.launchOptions.channel !== 'chromium' && browser.launchOptions.channel !== 'chrome-for-testing';
else
browser.launchOptions.chromiumSandbox = true;
}
if (browser.isolated && browser.userDataDir)
throw new Error('Browser userDataDir is not supported in isolated mode.');
if (browser.initScript) {
for (const script of browser.initScript) {
if (!await fileExistsAsync(script))
throw new Error(`Init script file does not exist: ${script}`);
}
}
if (browser.initPage) {
for (const page of browser.initPage) {
if (!await fileExistsAsync(page))
throw new Error(`Init page file does not exist: ${page}`);
}
}
if (browser.contextOptions.viewport === undefined) {
if (browser.launchOptions.headless)
browser.contextOptions.viewport = { width: 1280, height: 720 };
else
browser.contextOptions.viewport = null;View on GitHub (pinned to c8fc3bf8d3)
Solutions
- Choose one: drop `--isolated` to use the persistent `userDataDir`, or remove `userDataDir`/`--profile` to use isolated ephemeral contexts.
- Audit config file, CLI flags, and env vars for any source setting the conflicting option.
- Remember isolated mode is for parallel/fresh sessions; userDataDir is for a stable persistent profile — they are mutually exclusive by design.
Example fix
# before playwright mcp --isolated --user-data-dir ~/profile # after (persistent) playwright mcp --user-data-dir ~/profile # or (isolated) playwright mcp --isolated
Defensive patterns
Strategy: validation
Validate before calling
function validateBrowserOpts(opts: { isolated?: boolean; userDataDir?: string }) {
if (opts.isolated && opts.userDataDir)
throw new Error('Cannot combine isolated mode with a userDataDir; pick one.');
} Prevention
- Pick isolated OR persistent (userDataDir); never both.
- Audit config file, CLI flags, and env for conflicting sources.
- Treat isolated and userDataDir as mutually exclusive in your wrapper.
When it happens
Trigger: Passing `--isolated` together with `--user-data-dir`/`--profile` on the CLI, or setting both `isolated: true` and `userDataDir` in a config file / env. The check fires during `validateBrowserConfig`, which runs on every MCP and CLI config resolution.
Common situations: A config file sets `isolated: true` and the CLI also passes `--profile`; env var enables isolated while a config file sets userDataDir; user misunderstands isolated mode and tries to pin a profile on top of it.
Related errors
- "deviceScaleFactor" option is not supported with null "viewp
- "isMobile" option is not supported with null "viewport"
- geolocation.longitude: precondition -180 <= LONGITUDE <= 180
- geolocation.latitude: precondition -90 <= LATITUDE <= 90 fai
- geolocation.accuracy: precondition 0 <= ACCURACY failed.
AI-assisted analysis of microsoft/playwright@c8fc3bf8d3 (2026-08-12).
Data as JSON: /api/errors/9d312381268d0816.
Report an issue: GitHub.