{"record":{"id":"5ece8b4c6c8dc901","repo":"mantinedev/mantine","slug":"errormessage","errorCode":null,"errorMessage":"${errorMessage}","messagePattern":"\\$\\{errorMessage\\}","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@mantine/core/src/core/utils/get-safe-id/get-safe-id.ts","lineNumber":4,"sourceCode":"export function getSafeId(uid: string, errorMessage: string) {\n  return (value: string) => {\n    if (typeof value !== 'string' || value.trim().length === 0) {\n      throw new Error(errorMessage);\n    }\n\n    return `${uid}-${value}`;\n  };\n}\n","sourceCodeStart":1,"sourceCodeEnd":10,"githubUrl":"https://github.com/mantinedev/mantine/blob/8a284e2c2c53a9cb6f39f5dc389bf41b7a2073f8/packages/@mantine/core/src/core/utils/get-safe-id/get-safe-id.ts#L1-L10","documentation":"getSafeId builds element ids for components like Accordion and Tabs from a uid plus the control value. If the value passed to get:controlId is not a non-empty string (after trimming), Mantine throws the caller-supplied error message (e.g. Accordion: Item with value=\"...\"...), because ids must be deterministic and non-empty.","triggerScenarios":"Accordion.Item or Tabs.Tab without a value prop (undefined); value={''} or value={'   '} on a tab/accordion item; dynamic values that evaluate to empty strings.","commonSituations":"Dynamically generating items where the key field is missing for some records; refactoring from children-based Tabs.Item (no value needed) to value-based Tabs.Tab; whitespace-only values from user input.","solutions":["Ensure every Accordion.Item/Tabs.Tab has a unique non-empty string value","For dynamic data, guard: items.filter((i) => i.value?.trim()) or default the value"],"exampleFix":"// before\n<Tabs.Tab label=\"Settings\">...</Tabs.Tab> // no value\n\n// after\n<Tabs.Tab value=\"settings\">Settings</Tabs.Tab>","handlingStrategy":"validation","validationCode":"const safeValue = (v?: string) =>\n  typeof v === 'string' && v.trim().length > 0 ? v : `fallback-${nanoid()}`;\n\n<Tabs.Tab value={safeValue(item.slug)}>...</Tabs.Tab>;","typeGuard":"function isNonEmptyValue(v: unknown): v is string {\n  return typeof v === 'string' && v.trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["Always set explicit value props on Accordion.Item/Tabs.Tab","Filter out items lacking slugs/keys before mapping","Use TypeScript so missing value props are compile-time errors"],"tags":["accordion","tabs","value-prop","id-generation"],"backgroundTag":"missing-value-prop","analyzedSha":"8a284e2c2c53a9cb6f39f5dc389bf41b7a2073f8","analyzedAt":"2026-08-28T10:25:51.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}