microsoft/playwright · error · Error
Device descriptor not found: '${options.device}', available
Error message
Device descriptor not found: '${options.device}', available devices are: What it means
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)`.
Source
Thrown at packages/playwright-core/src/cli/browserActions.ts:365
switch (name) {
case 'chromium': browserType = playwright.chromium; break;
case 'webkit': browserType = playwright.webkit; break;
case 'firefox': browserType = playwright.firefox; break;
case 'cr': browserType = playwright.chromium; break;
case 'wk': browserType = playwright.webkit; break;
case 'ff': browserType = playwright.firefox; break;
}
if (browserType)
return browserType;
program.help();
}
function validateOptions(options: Options) {
if (options.device && !(options.device in playwright.devices)) {
const lines = [`Device descriptor not found: '${options.device}', available devices are:`];
for (const name in playwright.devices)
lines.push(` "${name}"`);
throw new Error(lines.join('\n'));
}
if (options.colorScheme && !['light', 'dark'].includes(options.colorScheme))
throw new Error('Invalid color scheme, should be one of "light", "dark"');
}
View on GitHub (pinned to c8fc3bf8d3)
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.
Example fix
# before npx playwright open --device='Pixel 7' https://example.com # not a real descriptor # after npx playwright open --device='Pixel 5' https://example.com # use a listed name
Defensive patterns
Strategy: validation
Validate before calling
import devices from 'playwright-core/devices';
function assertDeviceKnown(name?: string) {
if (name && !(name in devices))
throw new Error(`Unknown device '${name}'. Valid: ${Object.keys(devices).slice(0, 10).join(', ')}...`);
} Type guard
import devices from 'playwright-core/devices';
function isKnownDevice(name: string): boolean {
return name in devices;
} Try / catch
try {
validateOptions(options);
} catch (e) {
if (/Device descriptor not found/.test(e.message)) {
const suggest = closestMatch(options.device, Object.keys(devices));
throw new Error(`Unknown device '${options.device}'. Did you mean '${suggest}'?`);
}
throw e;
} Prevention
- 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.
When it happens
Trigger: 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`.
Common situations: Typo in the device name; using a marketing name instead of the descriptor key; outdated Playwright version lacking a newer device; case mismatch.
Related errors
- Invalid viewport size format: use "width,height", for exampl
- Invalid geolocation format, should be "lat,long". For exampl
- Error while parsing selector `${selector}` - selector cannot
- PDF creation is only working with Chromium
- Invalid color scheme, should be one of "light", "dark"
AI-assisted analysis of microsoft/playwright@c8fc3bf8d3 (2026-08-12).
Data as JSON: /api/errors/c10c8c3273fd23f9.
Report an issue: GitHub.