{"record":{"id":"0986cf63f275f009","repo":"mantinedev/mantine","slug":"mantine-core-duplicate-options-are-not-supporte","errorCode":null,"errorMessage":"[@mantine/core] Duplicate options are not supported. Option with value \"${option.value}\" was provided more than once","messagePattern":"\\[@mantine/core\\] Duplicate options are not supported\\. Option with value \"(.+?)\" was provided more than once","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@mantine/core/src/components/Combobox/OptionsDropdown/validate-options.ts","lineNumber":17,"sourceCode":"import { isOptionsGroup } from './is-options-group';\n\nexport function validateOptions(options: any[], valuesSet = new Set()) {\n  if (!Array.isArray(options)) {\n    return;\n  }\n\n  for (const option of options) {\n    if (isOptionsGroup(option)) {\n      validateOptions(option.items, valuesSet);\n    } else {\n      if (typeof option.value === 'undefined') {\n        throw new Error('[@mantine/core] Each option must have value property');\n      }\n\n      if (valuesSet.has(option.value)) {\n        throw new Error(\n          `[@mantine/core] Duplicate options are not supported. Option with value \"${option.value}\" was provided more than once`\n        );\n      }\n\n      valuesSet.add(option.value);\n    }\n  }\n}\n","sourceCodeStart":1,"sourceCodeEnd":26,"githubUrl":"https://github.com/mantinedev/mantine/blob/8a284e2c2c53a9cb6f39f5dc389bf41b7a2073f8/packages/@mantine/core/src/components/Combobox/OptionsDropdown/validate-options.ts#L1-L26","documentation":"Combobox-based components require all option values to be unique. During render, Mantine builds a set of seen values and throws when the same value appears twice, because duplicate values make selection, keyboard navigation and label lookup ambiguous.","triggerScenarios":"Passing data with two options having the same value string, e.g. [{ value: 'a', label: '1' }, { value: 'a', label: '2' }]; concatenating two API result sets that share ids; grouped data where the same value appears in two different groups.","commonSituations":"Merging static defaults with server-fetched options that overlap; API returning duplicate records; case differences intended as distinct (values are compared as exact strings); refactoring numbers to strings causing collisions (e.g. 1 and '1' both stringified).","solutions":["Deduplicate the data array by value before passing it: const unique = [...new Map(data.map((o) => [o.value, o])).values()]","Fix the source data so each option has a distinct value","If values come from an API, deduplicate on fetch or fix the backend query"],"exampleFix":"// before\nconst data = [\n  { value: 'a', label: 'One' },\n  { value: 'a', label: 'Two' },\n];\n\n// after\nconst data = [\n  { value: 'a', label: 'One' },\n  { value: 'b', label: 'Two' },\n];\n\n// or dedupe programmatically\nconst data = [...new Map(raw.map((o) => [o.value, o])).values()];","handlingStrategy":"validation","validationCode":"const uniqueByValue = (data) =>\n  [...new Map(data.map((o) => [o.value, o])).values()];\n\n<Select data={uniqueByValue(rawData)} />;","typeGuard":"function hasUniqueValues(data: { value: string }[]): boolean {\n  return new Set(data.map((o) => o.value)).size === data.length;\n}","tryCatchPattern":null,"preventionTips":["Deduplicate merged option arrays at the data layer","Write a unit test asserting Set(data.map(o => o.value)).size === data.length for option sources","Treat option values as database-like primary keys"],"tags":["combobox","select","duplicate-values","options"],"backgroundTag":"duplicate-option-values","analyzedSha":"8a284e2c2c53a9cb6f39f5dc389bf41b7a2073f8","analyzedAt":"2026-08-28T10:25:51.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}