{"record":{"id":"50bf54c586ea1eec","repo":"mantinedev/mantine","slug":"mantine-core-each-option-must-have-value-proper","errorCode":null,"errorMessage":"[@mantine/core] Each option must have value property","messagePattern":"\\[@mantine/core\\] Each option must have value property","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@mantine/core/src/components/Combobox/OptionsDropdown/validate-options.ts","lineNumber":13,"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 (Select, MultiSelect, Autocomplete, TagsInput, etc.) validate their data before rendering. Every option object passed in the data prop must include a value property (string). This error is thrown during render when an option is missing value, which almost always means the data array contains malformed objects (e.g. only label, or wrong property names).","triggerScenarios":"Passing data like [{ label: 'Foo' }] (no value), mapping API results to objects that omit value, or spreading objects where value is undefined (e.g. { ...item, value: item.id } when item.id is undefined).","commonSituations":"Fetching options from an API where some records lack the id/name field being used as value; renaming fields during a refactor; using Combobox.Option directly (which is fine) vs raw data with wrong shape; TypeScript types bypassed with any.","solutions":["Add a value property to every option in the data array","Map API data to ensure value is always a string: data.map((i) => ({ value: String(i.id), label: i.name }))","Filter out malformed records before passing data: data.filter((o) => o.value !== undefined)","If using grouped data, verify each item inside items arrays also has value"],"exampleFix":"// before\nconst data = [{ label: 'Foo' }, { label: 'Bar' }];\n\n// after\nconst data = [\n  { value: 'foo', label: 'Foo' },\n  { value: 'bar', label: 'Bar' },\n];","handlingStrategy":"validation","validationCode":"const hasValidOptions = (data) =>\n  data.every((o) => !o.items || hasValidOptions(o.items)) &&\n  data.every((o) => o.items || typeof o.value !== 'undefined');\n\nif (!hasValidOptions(data)) {\n  // log and fall back to empty data\n}","typeGuard":"type ComboboxItem = { value: string; label?: string };\ntype OptionsGroup = { group: string; items: ComboboxItem[] };\n\nfunction isComboboxData(v: unknown): v is (ComboboxItem | OptionsGroup)[] {\n  return (\n    Array.isArray(v) &&\n    v.every(\n      (o) =>\n        (typeof o === 'object' && o !== null && typeof (o as ComboboxItem).value === 'string') ||\n        (typeof (o as OptionsGroup).items !== 'undefined')\n    )\n  );\n}","tryCatchPattern":null,"preventionTips":["Type data as ComboboxItem[] instead of any[] so TypeScript catches missing value","Validate/normalize API responses with a mapping step instead of passing raw JSON to data","Filter records without ids at the fetch layer"],"tags":["combobox","select","options","props-validation"],"backgroundTag":"options-data-validation-failed","analyzedSha":"8a284e2c2c53a9cb6f39f5dc389bf41b7a2073f8","analyzedAt":"2026-08-28T10:25:51.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}