{"record":{"id":"c10c8c3273fd23f9","repo":"microsoft/playwright","slug":"device-descriptor-not-found-options-device","errorCode":null,"errorMessage":"Device descriptor not found: '${options.device}', available devices are:","messagePattern":"Device descriptor not found: '(.+?)', available devices are:","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/cli/browserActions.ts","lineNumber":365,"sourceCode":"  switch (name) {\n    case 'chromium': browserType = playwright.chromium; break;\n    case 'webkit': browserType = playwright.webkit; break;\n    case 'firefox': browserType = playwright.firefox; break;\n    case 'cr': browserType = playwright.chromium; break;\n    case 'wk': browserType = playwright.webkit; break;\n    case 'ff': browserType = playwright.firefox; break;\n  }\n  if (browserType)\n    return browserType;\n  program.help();\n}\n\nfunction validateOptions(options: Options) {\n  if (options.device && !(options.device in playwright.devices)) {\n    const lines = [`Device descriptor not found: '${options.device}', available devices are:`];\n    for (const name in playwright.devices)\n      lines.push(`  \"${name}\"`);\n    throw new Error(lines.join('\\n'));\n  }\n  if (options.colorScheme && !['light', 'dark'].includes(options.colorScheme))\n    throw new Error('Invalid color scheme, should be one of \"light\", \"dark\"');\n}\n","sourceCodeStart":347,"sourceCodeEnd":370,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/cli/browserActions.ts#L347-L370","documentation":"Thrown by validateOptions when `--device` names a key not present in `playwright.devices`. The error message lists all available device descriptors to help correction. The check is `options.device && !(options.device in playwright.devices)`.","triggerScenarios":"Running `playwright open --device=PixelX` (typo or non-existent descriptor) or any CLI command consuming `--device`. The descriptor name must exactly match a key exported by `DeviceDescriptors`.","commonSituations":"Typo in the device name; using a marketing name instead of the descriptor key; outdated Playwright version lacking a newer device; case mismatch.","solutions":["Read the error output: it enumerates every valid descriptor name.","Copy the exact descriptor string (including spacing/capitalization) from the list.","Upgrade Playwright if you need a device added in a newer release."],"exampleFix":"# before\nnpx playwright open --device='Pixel 7' https://example.com  # not a real descriptor\n\n# after\nnpx playwright open --device='Pixel 5' https://example.com  # use a listed name","handlingStrategy":"validation","validationCode":"import devices from 'playwright-core/devices';\nfunction assertDeviceKnown(name?: string) {\n  if (name && !(name in devices))\n    throw new Error(`Unknown device '${name}'. Valid: ${Object.keys(devices).slice(0, 10).join(', ')}...`);\n}","typeGuard":"import devices from 'playwright-core/devices';\nfunction isKnownDevice(name: string): boolean {\n  return name in devices;\n}","tryCatchPattern":"try {\n  validateOptions(options);\n} catch (e) {\n  if (/Device descriptor not found/.test(e.message)) {\n    const suggest = closestMatch(options.device, Object.keys(devices));\n    throw new Error(`Unknown device '${options.device}'. Did you mean '${suggest}'?`);\n  }\n  throw e;\n}","preventionTips":["Copy device names verbatim from the error output or the devices export.","Upgrade Playwright to access newer descriptors.","Wrap CLI invocations with a device-name validator in scripts."],"tags":["cli","device-descriptors","validation","user-input"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}