TanStack/table · warning

sortFn '${sortFnName}' (auto) for column '${column.id}' is n

Error message

sortFn '${sortFnName}' (auto) for column '${column.id}' is not registered

What it means

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.

Source

Thrown at packages/table-core/src/features/row-sorting/rowSortingFeature.utils.ts:150

      isString = true

      if (value.split(reSplitAlphaNumeric).length > 1) {
        sortFnName = 'alphanumeric'
        break
      }
    }
  }

  if (!sortFnName && isString) {
    sortFnName = 'text'
  }

  if (sortFnName) {
    let sortFn = sortFns?.[sortFnName]

    if (!sortFn) {
      if (process.env.NODE_ENV === 'development') {
        console.warn(
          `sortFn '${sortFnName}' (auto) for column '${column.id}' is not registered`,
        )
      }

      // String columns degrade to a registered text sort before basic
      if (sortFnName === 'alphanumeric') {
        sortFn = sortFns?.text
      }
    }

    if (sortFn) {
      return sortFn
    }
  }

  return sortFn_basic
}

View on GitHub (pinned to d01c01bedb)

Solutions

  1. 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).
  2. Set an explicit `sortFn` on the columnDef (a function or a registered id) so auto-detection is bypassed.
  3. If auto picks 'alphanumeric' but only 'text' is registered, accept the automatic degrade to `text`, or add an 'alphanumeric' entry.
  4. Check `table._rowModelFns.sortFns` at runtime to see which ids are actually registered.

Example fix

// before
const table = createTable({
  features: tableFeatures({ rowSortingFeature, slimRowModel }),
  columns: [{ accessorKey: 'createdAt' }], // auto -> 'datetime' unregistered
})

// after
columns: [{
  accessorKey: 'createdAt',
  sortFn: (rowA, rowB, columnId) => // explicit, no registry needed
    (rowA.getValue<Date>(columnId)?.getTime() ?? 0) -
    (rowB.getValue<Date>(columnId)?.getTime() ?? 0),
}]
Defensive patterns

Strategy: validation

Validate before calling

const requiredAutoSortFns = ['datetime', 'alphanumeric', 'text']
const registered = table._rowModelFns.sortFns ?? {}
const missing = requiredAutoSortFns.filter((id) => !(id in registered))
if (missing.length && process.env.NODE_ENV !== 'production') {
  console.warn(`Auto sorting will degrade for columns needing: ${missing.join(', ')}`)
}

Type guard

function hasFullSortRegistry(table, required = ['datetime', 'alphanumeric', 'text']) {
  const sortFns = table._rowModelFns?.sortFns
  return !!sortFns && required.every((id) => typeof sortFns[id] === 'function')
}

Prevention

When it happens

Trigger: 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'.

Common situations: 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.

Related errors


AI-assisted analysis of TanStack/table@d01c01bedb (2026-08-28). Data as JSON: /api/errors/47e1ecb0847aa87b. Report an issue: GitHub.