{"record":{"id":"4e8c1d42cb731278","repo":"GoogleChrome/lighthouse","slug":"unrecognized-category-in-onlycategories-unkno","errorCode":null,"errorMessage":"unrecognized category in 'onlyCategories': ${unknown.join(', ')}","messagePattern":"unrecognized category in 'onlyCategories': (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"core/config/filters.js","lineNumber":190,"sourceCode":"  const categoriesToKeep = Object.entries(categories)\n    .filter(([categoryId]) => onlyCategories.includes(categoryId));\n  return Object.fromEntries(categoriesToKeep);\n}\n\n/**\n * Throw an error if any specified onlyCategory is not a known category that can\n * be included.\n *\n * @param {LH.Config.ResolvedConfig['categories']} allCategories\n * @param {string[] | null} onlyCategories\n * @return {void}\n */\nfunction errorOnUnknownOnlyCategories(allCategories, onlyCategories) {\n  if (!onlyCategories) return;\n\n  const unknown = onlyCategories.filter(c => !allCategories?.[c]);\n  if (unknown.length) {\n    throw new Error(`unrecognized category in 'onlyCategories': ${unknown.join(', ')}`);\n  }\n}\n\n/**\n * Filters a categories object and their auditRefs down to the set that can be computed using\n * only the specified audits.\n *\n * @param {LH.Config.ResolvedConfig['categories']} categories\n * @param {Array<LH.Config.AuditDefn>} availableAudits\n * @return {LH.Config.ResolvedConfig['categories']}\n */\nfunction filterCategoriesByAvailableAudits(categories, availableAudits) {\n  if (!categories) return categories;\n\n  const availableAuditIdToMeta = new Map(\n    availableAudits.map(audit => [audit.implementation.meta.id, audit.implementation.meta])\n  );\n","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/GoogleChrome/lighthouse/blob/9515cd4e58ebed69f78742d932b501c2cab8ad8f/core/config/filters.js#L172-L208","documentation":"Thrown by errorOnUnknownOnlyCategories in filters.js. When settings.onlyCategories lists category ids, every id must exist as a key in the resolved config's categories. Lighthouse filters the run to those categories, so an unknown id is rejected rather than silently ignored. The message lists the offending ids.","triggerScenarios":"flags.onlyCategories = ['seo','typo-cat'] where 'typo-cat' is not a category id in the config. The filter collects ids not present in allCategories and filters.js:190 throws, naming them.","commonSituations":"Typo in a category id. Using onlyCategories with a config that does not include that category (e.g. a perf-only config). Category renamed/removed after a Lighthouse upgrade. Plugin category id mismatch (plugin ids are prefixed 'lighthouse-plugin-').","solutions":["Correct the category id to match a key in the resolved config (e.g. 'performance','accessibility','seo').","If filtering to a plugin category, use its full id 'lighthouse-plugin-<name>'.","Print Object.keys(config.categories) to confirm valid ids before setting onlyCategories."],"exampleFix":"// before\nconst flags = {onlyCategories: ['performnce']};\n// after\nconst flags = {onlyCategories: ['performance']};","handlingStrategy":"validation","validationCode":"const known = new Set(Object.keys(resolvedConfig.categories || {}));\nconst unknown = (flags.onlyCategories || []).filter(c => !known.has(c));\nif (unknown.length) throw new Error('Unknown onlyCategories: ' + unknown.join(', '));","typeGuard":"function onlyCategoriesAreKnown(cats, known) {\n  return Array.isArray(cats) && cats.every(c => known.has(c));\n}","tryCatchPattern":"try { await lighthouse(url, flags, config); }\ncatch (e) { if (/unrecognized category in 'onlyCategories'/.test(e.message)) console.error(e.message); throw e; }","preventionTips":["Log Object.keys(config.categories) to confirm valid ids.","Remember plugin categories are prefixed 'lighthouse-plugin-'.","Watch for typos and renamed categories after upgrades."],"tags":["config","lighthouse","filters","validation","categories"],"backgroundTag":null,"analyzedSha":"9515cd4e58ebed69f78742d932b501c2cab8ad8f","analyzedAt":"2026-08-13T06:28:10.346Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}