TanStack/table · warning
sortFn '${String(column.columnDef.sortFn)}' for column '${co
Error message
sortFn '${String(column.columnDef.sortFn)}' for column '${column.id}' is not registered What it means
When `columnDef.sortFn` is a string, `column_getSortFn` looks it up in the table's `sortFns` registry. If the id is not found, this dev warning fires and the column silently falls back to `sortFn_basic`, so rows still sort but not with the semantics you intended (e.g. locale-aware text or date ordering is lost).
Source
Thrown at packages/table-core/src/features/row-sorting/rowSortingFeature.utils.ts:234
TFeatures extends TableFeatures,
TData extends RowData,
TValue extends CellData = CellData,
>(column: Column_Internal<TFeatures, TData, TValue>): SortFn<TFeatures, TData> {
const sortFns: Record<string, SortFn<TFeatures, TData>> | undefined =
column.table._rowModelFns.sortFns
if (isFunction(column.columnDef.sortFn)) {
return column.columnDef.sortFn
}
if (column.columnDef.sortFn === 'auto') {
return column_getAutoSortFn(column)
}
const sortFn = sortFns?.[column.columnDef.sortFn as string]
if (process.env.NODE_ENV === 'development' && !sortFn) {
console.warn(
`sortFn '${String(column.columnDef.sortFn)}' for column '${column.id}' is not registered`,
)
}
return sortFn ?? sortFn_basic
}
/**
* Applies the next sorting state for this column.
*
* The toggle can add, replace, flip, or remove this column's sort entry. Multi
* sorting respects `enableMultiSort`, `enableMultiRemove`,
* `maxMultiSortColCount`, and the `multi` argument.
*
* @example
* ```ts
* column_toggleSorting(column, undefined, true)
* ```View on GitHub (pinned to d01c01bedb)
Solutions
- Fix the sortFn id typo or use a registered built-in id ('text', 'alphanumeric', 'datetime', 'basic').
- Add the missing function to the table's `sortFns` registry (e.g. extend the sorting row-model feature's sortFns with { mySort: fn }).
- Pass a function directly as `columnDef.sortFn` to skip the registry lookup entirely.
- Log `table._rowModelFns.sortFns` (Object.keys) to confirm which ids exist before referencing one.
Example fix
// before
{ accessorKey: 'name', sortFn: 'alphnumeric' } // typo, falls back to basic
// after
{ accessorKey: 'name', sortFn: 'alphanumeric' }
// or register the custom one:
// sortFns: { ...builtInSortFns, localeText: makeLocaleTextSort('de-DE') }
// { accessorKey: 'name', sortFn: 'localeText' } Defensive patterns
Strategy: validation
Validate before calling
const SORT_FN_IDS = new Set(['basic', 'text', 'alphanumeric', 'datetime'])
function assertSortFnRegistered(table, columns) {
const registered = new Set(Object.keys(table._rowModelFns.sortFns ?? {}))
for (const col of columns) {
const sf = col.sortFn
if (typeof sf === 'string' && sf !== 'auto' &&
!SORT_FN_IDS.has(sf) && !registered.has(sf)) {
throw new Error(`sortFn '${sf}' on column '${col.id ?? col.accessorKey}' is not registered`)
}
}
} Type guard
function isRegisteredSortFn(table, id) {
if (id === undefined || id === 'auto' || typeof id === 'function') return true
const sortFns = table._rowModelFns?.sortFns
return typeof id === 'string' && !!sortFns && typeof sortFns[id] === 'function'
} Prevention
- Centralize sortFn ids as constants so typos are caught at compile time.
- Validate all columnDefs against the registry once at table setup.
- Prefer passing a function as sortFn for custom comparators — no registry lookup, no fallback.
- Re-audit string sortFn ids whenever upgrading the library or changing row-model packages.
When it happens
Trigger: Setting `columnDef.sortFn: 'datetime'` (or any custom id like 'mySort') while that id is absent from `table._rowModelFns.sortFns` — e.g. a typo ('alphnumeric'), a built-in id not included in the installed sorting row-model package, or a custom sort fn that was never added to the `sortFns` registry.
Common situations: Typos in sortFn ids; upgrading/downgrading the library and a sort id being renamed or moved to an optional package; forgetting to pass custom sortFns when creating the table with a custom row-model feature set; sharing column defs between tables whose registries differ.
Related errors
- sortFn '${sortFnName}' (auto) for column '${column.id}' is n
- globalFilterFn '${String(globalFilterFn)}' is not registered
- ${message}
- aggregationFn '${String(ref)}' for column '${column.id}' is
- aggregationFn at index ${i} for column '${column.id}' needs
AI-assisted analysis of TanStack/table@d01c01bedb (2026-08-28).
Data as JSON: /api/errors/48e59f207815170f.
Report an issue: GitHub.