{"record":{"id":"23b13b2848717a63","repo":"GoogleChrome/lighthouse","slug":"unrecognized-screenemulation-option-key","errorCode":null,"errorMessage":"Unrecognized screenEmulation option: ${key}","messagePattern":"Unrecognized screenEmulation option: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/cli-flags.js","lineNumber":538,"sourceCode":"        screenEmulationSettings[key] = possibleSetting;\n\n        break;\n      case 'mobile':\n      case 'disabled':\n        // Manually coerce 'true'/'false' strings to booleans since nested property types aren't set.\n        if (possibleSetting === 'true') {\n          screenEmulationSettings[key] = true;\n        } else if (possibleSetting === 'false') {\n          screenEmulationSettings[key] = false;\n        } else if (possibleSetting === undefined || typeof possibleSetting === 'boolean') {\n          screenEmulationSettings[key] = possibleSetting;\n        } else {\n          throw new Error(`Invalid value: 'screenEmulation.${key}' must be a boolean`);\n        }\n\n        break;\n      default:\n        throw new Error(`Unrecognized screenEmulation option: ${key}`);\n    }\n  }\n\n  return screenEmulationSettings;\n}\n\nexport {\n  getFlags,\n  getYargsParser,\n};\n","sourceCodeStart":520,"sourceCodeEnd":549,"githubUrl":"https://github.com/GoogleChrome/lighthouse/blob/9515cd4e58ebed69f78742d932b501c2cab8ad8f/cli/cli-flags.js#L520-L549","documentation":"Within coerceScreenEmulation's switch statement, the default case handles any key in the iteration that doesn't match width, height, deviceScaleFactor, mobile, or disabled. In practice this case is effectively unreachable because the keys array iterated is a hardcoded constant containing only those five keys. The error would only fire if the hardcoded keys array were extended with a new key without adding a corresponding switch case.","triggerScenarios":"This error is not triggerable through normal CLI usage. It would only occur if a developer modified the keys array in coerceScreenEmulation to include a new property name without adding a matching case to the switch statement. It is a defensive guard against incomplete code changes within Lighthouse itself.","commonSituations":"Contributing to Lighthouse and adding a new screenEmulation property to the keys array without updating the switch; forking Lighthouse and extending screenEmulation settings incompletely.","solutions":["If you are a Lighthouse contributor who hit this, add a matching case to the switch statement in coerceScreenEmulation for the new key","If you are an end user, this error indicates a bug in your Lighthouse build — report it or use an official release","No end-user CLI input can trigger this error"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["This error is unreachable via normal CLI usage — no end-user prevention needed","If contributing to Lighthouse, always add a switch case when extending the keys array in coerceScreenEmulation","Add a unit test covering any new screenEmulation property to catch this at development time"],"tags":["cli","validation","emulation","unreachable","internal"],"backgroundTag":null,"analyzedSha":"9515cd4e58ebed69f78742d932b501c2cab8ad8f","analyzedAt":"2026-08-13T06:28:10.346Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}