{"record":{"id":"dae5f40af9136d9d","repo":"facebook/docusaurus","slug":"docusaurus-error-duplicate-values-dup-map-a","errorCode":null,"errorMessage":"Docusaurus error: Duplicate values \"${dup.map((a) => `'${a.value}'`).join(', ')}\" found in <Tabs>. Every value needs to be unique.","messagePattern":"Docusaurus error: Duplicate values \"(.+?)'`\\)\\.join\\(', '\\)\\}\" found in <Tabs>\\. Every value needs to be unique\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/docusaurus-theme-common/src/utils/tabsUtils.tsx","lineNumber":100,"sourceCode":"      `Docusaurus error: Bad <Tabs> child <${badChildTypeName}>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique \"value\" prop.\nIf you do not want to pass on a \"value\" prop to the direct children of <Tabs>, you can also pass an explicit <Tabs values={...}> prop.`,\n    );\n  });\n\n  return elements.map(\n    ({props: {value, label, attributes, default: isDefault}}) => ({\n      value,\n      label,\n      attributes,\n      default: isDefault,\n    }),\n  );\n}\n\nfunction ensureNoDuplicateValue(values: readonly TabValue[]) {\n  const dup = duplicates(values, (a, b) => a.value === b.value);\n  if (dup.length > 0) {\n    throw new Error(\n      `Docusaurus error: Duplicate values \"${dup\n        .map((a) => `'${a.value}'`)\n        .join(', ')}\" found in <Tabs>. Every value needs to be unique.`,\n    );\n  }\n}\n\nfunction useTabValues(\n  props: Pick<TabsProps, 'values' | 'children'>,\n): readonly TabValue[] {\n  const {values: valuesProp, children} = props;\n  return useMemo(() => {\n    const values = valuesProp ?? extractChildrenTabValues(children);\n    ensureNoDuplicateValue(values);\n    return values;\n  }, [valuesProp, children]);\n}\n","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/facebook/docusaurus/blob/3f483e80e326cc646b54b83d564b3f0c4881b9a6/packages/docusaurus-theme-common/src/utils/tabsUtils.tsx#L82-L118","documentation":"Thrown by `ensureNoDuplicateValue` when two or more `<TabItem>` children (or entries in the `values` prop) share the same `value`. `value` is the tab identity used for state persistence and URL syncing, so duplicates are ambiguous and rejected.","triggerScenarios":"Authoring `<Tabs>` with multiple `<TabItem value=\"x\">` entries, or a `values={[{value:'x'},{value:'x'}]}` array with repeats. The duplicated values are listed in the message.","commonSituations":"Copy-pasting TabItems without changing `value`; using the same `value` across tabs in different languages by mistake; refactoring tabs and forgetting to unique the keys.","solutions":["Make every `TabItem` `value` unique within its `<Tabs>` (the error lists the offenders).","If two tabs legitimately share a label, give them distinct `value`s (e.g. `'tab-a'`, `'tab-b'`) and reuse `label`.","Lint your MDX tab usage in CI to catch duplicate values."],"exampleFix":"// before\n<Tabs>\n  <TabItem value=\"x\" label=\"A\">A</TabItem>\n  <TabItem value=\"x\" label=\"B\">B</TabItem>\n</Tabs>\n// after\n<Tabs>\n  <TabItem value=\"a\" label=\"A\">A</TabItem>\n  <TabItem value=\"b\" label=\"B\">B</TabItem>\n</Tabs>","handlingStrategy":"validation","validationCode":"function findDuplicateTabValues(items: {value: string}[]): string[] {\n  const seen = new Set<string>(), dups = new Set<string>();\n  for (const i of items) (seen.has(i.value) ? dups : seen).add(i.value);\n  return [...dups];\n}","typeGuard":"function hasUniqueTabValues(items: {value: string}[]): boolean {\n  return new Set(items.map(i => i.value)).size === items.length;\n}","tryCatchPattern":null,"preventionTips":["Give each `<TabItem>` a distinct `value`.","Lint MDX `<Tabs>` for duplicate values in CI.","When generating tabs dynamically, derive `value` from a unique key."],"tags":["mdx","tabs","validation","theme-common"],"backgroundTag":null,"analyzedSha":"3f483e80e326cc646b54b83d564b3f0c4881b9a6","analyzedAt":"2026-08-12T13:25:04.382Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}