microsoft/playwright · error · Error
Init page file does not exist
Error message
Init page file does not exist: ${page} What it means
Thrown by validateBrowserConfig() for each entry in browser.initPage that does not point to an existing file, checked via fileExistsAsync. initPage entries are HTML files loaded as an initial page when the browser starts; a missing file would leave the MCP server with no page to operate on. The check happens before launch so the failure is explicit.
Solutions
- Confirm the file exists at the resolved path printed in the error, from the same directory the MCP server starts in.
- Switch to an absolute path to eliminate cwd-dependent resolution.
- Re-check the filename for typos and case sensitivity (relevant on Linux).
- Ensure the file is readable by the process user.
Example fix
// before --init-page ./pages/start.html // after --init-page /srv/app/pages/start.html
Defensive patterns
Strategy: validation
Validate before calling
import fs from 'fs';
const ok = initPagePaths.every(p => fs.existsSync(p));
if (!ok) {
throw new Error(`Missing init page files: ${initPagePaths.filter(p => !fs.existsSync(p)).join(', ')}`);
} Type guard
function isExistingFile(p: string): boolean {
try { return fs.statSync(p).isFile(); } catch { return false; }
} Prevention
- Use absolute paths for init-page HTML files.
- Verify the files are committed and present in CI before the MCP server starts.
- Centralize init-page configuration in one config file so paths are auditable.
When it happens
Trigger: Passing --init-page ./welcome.html (or browser.initPage in config) where the HTML file does not exist or is not readable.
Common situations: HTML file moved or renamed; relative path resolved from the wrong cwd; file committed with a path that only exists on another developer's machine; typo in the filename.
Related errors
- Init script file does not exist
- Cannot use --mobile together with --device, pick one.
- Device emulation is not supported with cdpEndpoint.
- Invalid : . Valid values are
- Invalid resolution format: use
AI-assisted analysis of microsoft/playwright@f1d33b5029 (2026-08-12).
Data as JSON: /api/errors/38fe899887b52041.
Report an issue: GitHub.
Appendix: source
Thrown at packages/playwright-core/src/tools/mcp/config.ts:255
browser.launchOptions.chromiumSandbox = channel !== undefined && channel !== 'chromium' && 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;
}
if (browserName === 'chromium') {
browser.launchOptions.args = browser.launchOptions.args ?? [];
if (!browser.launchOptions.args.some(a => a.includes('--disable-blink-features')))
browser.launchOptions.args.push(`--disable-blink-features=AutomationControlled`);
}
return { ...browser, browserName };
}
View on GitHub (pinned to f1d33b5029)