{"record":{"id":"42d4d999f59277a8","repo":"microsoft/playwright","slug":"arguments-can-not-specify-page-to-be-opened-42d4d9","errorCode":null,"errorMessage":"Arguments can not specify page to be opened","messagePattern":"Arguments can not specify page to be opened","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/server/bidi/bidiFirefox.ts","lineNumber":112,"sourceCode":"\n  override supportsPipeTransport(): boolean {\n    return false;\n  }\n\n  override async prepareUserDataDir(options: types.LaunchOptions, userDataDir: string): Promise<void> {\n    await createProfile({\n      path: userDataDir,\n      preferences: options.firefoxUserPrefs || {},\n    });\n  }\n\n  override async defaultArgs(options: types.LaunchOptions, isPersistent: boolean, userDataDir: string) {\n    const { args = [], headless } = options;\n    const userDataDirArg = args.find(arg => arg.startsWith('-profile') || arg.startsWith('--profile'));\n    if (userDataDirArg)\n      throw this._createUserDataDirArgMisuseError('--profile');\n    if (args.find(arg => !arg.startsWith('-')))\n      throw new Error('Arguments can not specify page to be opened');\n    const firefoxArguments = ['--remote-debugging-port=0'];\n    if (headless)\n      firefoxArguments.push('--headless');\n    else\n      firefoxArguments.push('--foreground');\n    firefoxArguments.push(`--profile`, userDataDir);\n    firefoxArguments.push(...args);\n    return firefoxArguments;\n  }\n\n  override async waitForReadyState(options: types.LaunchOptions, browserLogsCollector: RecentLogsCollector): Promise<{ wsEndpoint?: string }> {\n    const result = new ManualPromise<{ wsEndpoint?: string }>();\n    browserLogsCollector.onMessage(message => {\n      const match = message.match(/WebDriver BiDi listening on (ws:\\/\\/.*)$/);\n      if (match)\n        result.resolve({ wsEndpoint: match[1] + '/session' });\n    });\n    return result;","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/server/bidi/bidiFirefox.ts#L94-L130","documentation":"Firefox launch arguments must all be flags (start with `-`). A bare argument would be interpreted by Firefox as a URL/file to open, which conflicts with Playwright's BiDi-controlled session. `defaultArgs` rejects any arg not starting with `-`.","triggerScenarios":"`firefox.launch({ args: ['https://example.com'] })`, `args: ['about:blank']`, or any non-flag value in launch args.","commonSituations":"Copy-pasting Chromium launch conventions (where a URL sometimes works) to Firefox; trying to open a startup URL via args instead of `page.goto`; passing profile paths without the `-profile` prefix.","solutions":["Remove URLs/bare values from `args`; navigate with `page.goto()` after launch","Use `baseURL` + `page.goto('/')` for startup navigation","If you need a profile, omit it — Playwright manages `--profile` itself"],"exampleFix":"// before\nconst b = await firefox.launch({ args: ['https://example.com'] });\n\n// after\nconst b = await firefox.launch();\nconst p = await b.newPage();\nawait p.goto('https://example.com');","handlingStrategy":"validation","validationCode":"function sanitizeFirefoxArgs(args: string[]): string[] {\n  const bad = args.filter(a => !a.startsWith('-'));\n  if (bad.length) {\n    throw new Error(\n      `Firefox launch args must be flags (start with '-'). Non-flag values (${bad.join(', ')}) are not supported; use page.goto() instead.`\n    );\n  }\n  return args;\n}\nawait firefox.launch({ args: sanitizeFirefoxArgs(rawArgs) });","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Don't reuse Chromium launch arg lists verbatim with Firefox","Navigate via page.goto() / baseURL, never via launch args","Let Playwright manage --profile"],"tags":["firefox","launch","args"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}