{"record":{"id":"5e80c3b154ce85fb","repo":"vuetifyjs/vuetify","slug":"missing-sort","errorCode":null,"errorMessage":"Missing sort!","messagePattern":"Missing sort!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vuetify/src/components/VDataTable/composables/sort.ts","lineNumber":140,"sourceCode":"    sortBy.value = newSortBy\n    if (page) page.value = 1\n  }\n\n  function isSorted (column: InternalDataTableHeader) {\n    return !!sortBy.value.find(item => item.key === column.key)\n  }\n\n  const data = { sortBy, toggleSort, isSorted }\n\n  provide(VDataTableSortSymbol, data)\n\n  return data\n}\n\nexport function useSort () {\n  const data = inject(VDataTableSortSymbol)\n\n  if (!data) throw new Error('Missing sort!')\n\n  return data\n}\n\n// TODO: abstract into project composable\nexport function useSortedItems<T extends InternalItem> (\n  props: {\n    customKeySort: Record<string, DataTableCompareFunction> | undefined\n  },\n  items: Ref<T[]>,\n  sortBy: Ref<readonly SortItem[]>,\n  options?: {\n    transform?: (item: T) => {}\n    sortFunctions?: Ref<Record<string, DataTableCompareFunction> | undefined>\n    sortRawFunctions?: Ref<Record<string, DataTableCompareFunction> | undefined>\n  },\n) {\n  const locale = useLocale()","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/vuetifyjs/vuetify/blob/8d153908dffb7592eb389ddbfbab955a0ccc977f/packages/vuetify/src/components/VDataTable/composables/sort.ts#L122-L158","documentation":"Thrown by useSort() when inject(VDataTableSortSymbol) is undefined. Sort state is created by createSort() and provided by the data-table root.","triggerScenarios":"Calling useSort() in a component that is not a descendant of a VDataTable-family component that ran createSort.","commonSituations":"Building a custom sortable header component outside the table, using the sort composable standalone, or duplicate Vuetify installs.","solutions":["Call useSort() only inside descendants of a VDataTable-family component.","For a custom table, run createSort(...) and provide(VDataTableSortSymbol, data).","Ensure a single Vuetify install so the symbol resolves identically."],"exampleFix":"// before\nconst { toggleSort } = useSort()\n\n// after\nimport { createSort, VDataTableSortSymbol } from 'vuetify/components/VDataTable/composables/sort'\nconst data = createSort(/* props */, /* emit */)\nprovide(VDataTableSortSymbol, data)","handlingStrategy":"type-guard","validationCode":"import { inject } from 'vue'\nimport { VDataTableSortSymbol } from 'vuetify/components/VDataTable/composables/sort'\nfunction hasSortProvider(): boolean {\n  return inject(VDataTableSortSymbol, null) != null\n}","typeGuard":"import { inject } from 'vue'\nimport { VDataTableSortSymbol } from 'vuetify/components/VDataTable/composables/sort'\nfunction insideSortableTable(): boolean {\n  return inject(VDataTableSortSymbol, null) != null\n}","tryCatchPattern":"try {\n  useSort()\n} catch (e) {\n  if (e instanceof Error && /Missing sort/.test(e.message)) {\n    // local sort fallback\n  } else throw e\n}","preventionTips":["Call sort composables only inside VDataTable descendants.","Re-provide the symbol in custom tables.","Avoid duplicate Vuetify installs."],"tags":["vdatatable","injection","composable-misuse","vue"],"backgroundTag":null,"analyzedSha":"8d153908dffb7592eb389ddbfbab955a0ccc977f","analyzedAt":"2026-08-12T21:54:20.596Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}