{"record":{"id":"c995edbd4be9bcaa","repo":"microsoft/playwright","slug":"only-one-of-dry-run-and-list-can-be-specified","errorCode":null,"errorMessage":"Only one of --dry-run and --list can be specified","messagePattern":"Only one of --dry-run and --list can be specified","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/cli/installActions.ts","lineNumber":120,"sourceCode":"      `    npx playwright install`,\n      ``,\n      `If your project does not yet depend on Playwright, first install the`,\n      `applicable npm package (most commonly @playwright/test), and`,\n      `then run Playwright's install command to download the browsers:`,\n      ``,\n      `    npm install @playwright/test`,\n      `    npx playwright install`,\n      ``,\n    ].join('\\n'), 1));\n  }\n  if (options.shell === false && options.onlyShell)\n    throw new Error(`Only one of --no-shell and --only-shell can be specified`);\n  const shell = options.shell === false ? 'no' : options.onlyShell ? 'only' : undefined;\n  const executables = registry.resolveBrowsers(args, { shell });\n  if (options.withDeps)\n    await registry.installDeps(executables, !!options.dryRun);\n  if (options.dryRun && options.list)\n    throw new Error(`Only one of --dry-run and --list can be specified`);\n  if (options.dryRun) {\n    for (const executable of executables) {\n      console.log(registry.calculateDownloadTitle(executable));\n      console.log(`  Install location:    ${executable.directory ?? '<system>'}`);\n      if (executable.downloadURLs?.length) {\n        const [url, ...fallbacks] = executable.downloadURLs;\n        console.log(`  Download url:        ${url}`);\n        for (let i = 0; i < fallbacks.length; ++i)\n          console.log(`  Download fallback ${i + 1}: ${fallbacks[i]}`);\n      }\n      console.log(``);\n    }\n  } else if (options.list) {\n    const browsers = await registry.listInstalledBrowsers();\n    printGroupedByPlaywrightVersion(browsers);\n  } else {\n    await registry.install(executables, { force: options.force });\n    await registry.validateHostRequirementsForExecutablesIfNeeded(executables, process.env.PW_LANG_NAME || 'javascript').catch((e: Error) => {","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/cli/installActions.ts#L102-L138","documentation":"Thrown by `playwright install` when both --dry-run (print what would be downloaded without installing) and --list (list available/executable browsers) are passed. Each flag is a different non-mutating inspection mode; combining them produces contradictory output, hence the guard `options.dryRun && options.list`.","triggerScenarios":"Running `npx playwright install --dry-run --list` or a script that appends both inspection flags. The error fires after executables are resolved but before either print branch runs.","commonSituations":"CI debugging scripts that bolt on flags incrementally; aliases that set --list by default while a developer adds --dry-run to test downloads.","solutions":["Use --dry-run alone to preview downloads: `npx playwright install --dry-run`.","Use --list alone to enumerate installed browsers: `npx playwright install --list`.","Remove the redundant flag from CI scripts or aliases."],"exampleFix":"// before\nnpx playwright install --dry-run --list\n// after\nnpx playwright install --list","handlingStrategy":"validation","validationCode":"if (args.includes('--dry-run') && args.includes('--list'))\n  throw new Error('Choose one inspection mode: --dry-run OR --list');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat --dry-run and --list as mutually exclusive in wrapper scripts.","Run install flags from a checked-in matrix, not ad-hoc command lines."],"tags":["cli","install","flag-conflict"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}