{"record":{"id":"47e1ecb0847aa87b","repo":"TanStack/table","slug":"sortfn-sortfnname-auto-for-column-column","errorCode":null,"errorMessage":"sortFn '${sortFnName}' (auto) for column '${column.id}' is not registered","messagePattern":"sortFn '(.+?)' \\(auto\\) for column '(.+?)' is not registered","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/table-core/src/features/row-sorting/rowSortingFeature.utils.ts","lineNumber":150,"sourceCode":"      isString = true\n\n      if (value.split(reSplitAlphaNumeric).length > 1) {\n        sortFnName = 'alphanumeric'\n        break\n      }\n    }\n  }\n\n  if (!sortFnName && isString) {\n    sortFnName = 'text'\n  }\n\n  if (sortFnName) {\n    let sortFn = sortFns?.[sortFnName]\n\n    if (!sortFn) {\n      if (process.env.NODE_ENV === 'development') {\n        console.warn(\n          `sortFn '${sortFnName}' (auto) for column '${column.id}' is not registered`,\n        )\n      }\n\n      // String columns degrade to a registered text sort before basic\n      if (sortFnName === 'alphanumeric') {\n        sortFn = sortFns?.text\n      }\n    }\n\n    if (sortFn) {\n      return sortFn\n    }\n  }\n\n  return sortFn_basic\n}\n","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/TanStack/table/blob/d01c01bedbab0ff6c2641f18b2fc9a11545d9bf6/packages/table-core/src/features/row-sorting/rowSortingFeature.utils.ts#L132-L168","documentation":"With `sortFn: 'auto'` (the default), the table samples the first ~10 filtered rows to pick a built-in sort function name ('datetime', 'alphanumeric', or 'text'), then looks it up in `table._rowModelFns.sortFns`. If the sampled data suggests a sort fn name that the current row-model feature set did not register, this dev warning fires and the column degrades to `text` (then `basic`) sorting, so ordering may be wrong for dates or mixed values.","triggerScenarios":"Calling `column_getAutoSortFn` / sorting a column whose data samples as Date-like or alphanumeric while the table's row-model package has no `sortFns` entry for that name — typically when using a slim core row-model build without the full sorting feature, or a custom `sortFns` registry that omits built-ins like 'datetime' or 'alphanumeric'.","commonSituations":"Tree-shaken/custom feature setup where `rowSortingFeature`'s built-in sortFns registry was replaced or not installed; providing a partial `sortFns` map that overrides the defaults; rendering a table whose first rows contain Date values in an environment with only 'text' registered.","solutions":["Register the missing built-in sort fn in the table's `sortFns` registry (e.g. ensure the full rowSorting row-model package with 'datetime'/'alphanumeric'/'text' is installed).","Set an explicit `sortFn` on the columnDef (a function or a registered id) so auto-detection is bypassed.","If auto picks 'alphanumeric' but only 'text' is registered, accept the automatic degrade to `text`, or add an 'alphanumeric' entry.","Check `table._rowModelFns.sortFns` at runtime to see which ids are actually registered."],"exampleFix":"// before\nconst table = createTable({\n  features: tableFeatures({ rowSortingFeature, slimRowModel }),\n  columns: [{ accessorKey: 'createdAt' }], // auto -> 'datetime' unregistered\n})\n\n// after\ncolumns: [{\n  accessorKey: 'createdAt',\n  sortFn: (rowA, rowB, columnId) => // explicit, no registry needed\n    (rowA.getValue<Date>(columnId)?.getTime() ?? 0) -\n    (rowB.getValue<Date>(columnId)?.getTime() ?? 0),\n}]","handlingStrategy":"validation","validationCode":"const requiredAutoSortFns = ['datetime', 'alphanumeric', 'text']\nconst registered = table._rowModelFns.sortFns ?? {}\nconst missing = requiredAutoSortFns.filter((id) => !(id in registered))\nif (missing.length && process.env.NODE_ENV !== 'production') {\n  console.warn(`Auto sorting will degrade for columns needing: ${missing.join(', ')}`)\n}","typeGuard":"function hasFullSortRegistry(table, required = ['datetime', 'alphanumeric', 'text']) {\n  const sortFns = table._rowModelFns?.sortFns\n  return !!sortFns && required.every((id) => typeof sortFns[id] === 'function')\n}","tryCatchPattern":null,"preventionTips":["Install the full sorting row-model package when relying on sortFn: 'auto'.","Give Date/mixed columns an explicit sortFn instead of trusting auto-detection.","Sanity-check table._rowModelFns.sortFns keys in a dev-time assertion after table creation."],"tags":["sorting","auto-detection","missing-registration","dev-warning"],"backgroundTag":"unregistered-sort-function","analyzedSha":"d01c01bedbab0ff6c2641f18b2fc9a11545d9bf6","analyzedAt":"2026-08-28T21:52:44.679Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}