{"record":{"id":"38fe899887b52041","repo":"microsoft/playwright","slug":"init-page-file-does-not-exist-page","errorCode":null,"errorMessage":"Init page file does not exist: ${page}","messagePattern":"Init page file does not exist: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/tools/mcp/config.ts","lineNumber":246,"sourceCode":"    if (process.platform === 'linux')\n      browser.launchOptions.chromiumSandbox = browser.launchOptions.channel !== 'chromium' && browser.launchOptions.channel !== 'chrome-for-testing';\n    else\n      browser.launchOptions.chromiumSandbox = true;\n  }\n\n  if (browser.isolated && browser.userDataDir)\n    throw new Error('Browser userDataDir is not supported in isolated mode.');\n\n  if (browser.initScript) {\n    for (const script of browser.initScript) {\n      if (!await fileExistsAsync(script))\n        throw new Error(`Init script file does not exist: ${script}`);\n    }\n  }\n  if (browser.initPage) {\n    for (const page of browser.initPage) {\n      if (!await fileExistsAsync(page))\n        throw new Error(`Init page file does not exist: ${page}`);\n    }\n  }\n  if (browser.contextOptions.viewport === undefined) {\n    if (browser.launchOptions.headless)\n      browser.contextOptions.viewport = { width: 1280, height: 720 };\n    else\n      browser.contextOptions.viewport = null;\n  }\n\n  if (browserName === 'chromium') {\n    browser.launchOptions.args = browser.launchOptions.args ?? [];\n    if (!browser.launchOptions.args.some(a => a.includes('--disable-blink-features')))\n      browser.launchOptions.args.push(`--disable-blink-features=AutomationControlled`);\n  }\n\n  return { ...browser, browserName };\n}\n","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/tools/mcp/config.ts#L228-L264","documentation":"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.","triggerScenarios":"Passing --init-page ./welcome.html (or browser.initPage in config) where the HTML file does not exist or is not readable.","commonSituations":"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.","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."],"exampleFix":"// before\n--init-page ./pages/start.html\n// after\n--init-page /srv/app/pages/start.html","handlingStrategy":"validation","validationCode":"import fs from 'fs';\nconst ok = initPagePaths.every(p => fs.existsSync(p));\nif (!ok) {\n  throw new Error(`Missing init page files: ${initPagePaths.filter(p => !fs.existsSync(p)).join(', ')}`);\n}","typeGuard":"function isExistingFile(p: string): boolean {\n  try { return fs.statSync(p).isFile(); } catch { return false; }\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["mcp","config","filesystem","init-page","validation"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}