TanStack/table · error
getRow could not find row with ID: ${rowId}
Error message
getRow could not find row with ID: ${rowId} What it means
table.getRow(rowId) looks the row up in the (grouped/expanded) row model's rowsById, falling back to the core row model. If the ID exists in neither, the library throws this dev-mode error. Row IDs are generated from row id keys and grouping/expansion paths, so a lookup with an unknown ID fails.
Source
Thrown at packages/table-core/src/core/rows/coreRowsFeature.utils.ts:352
* ```
*/
export function table_getRow<
TFeatures extends TableFeatures,
TData extends RowData,
>(
table: Table_Internal<TFeatures, TData>,
rowId: string,
searchAll?: boolean,
): Row<TFeatures, TData> {
// TODO - simplify this across different row models
let row = (searchAll ? table.getPrePaginatedRowModel() : table.getRowModel())
.rowsById[rowId]
if (!row) {
row = table.getCoreRowModel().rowsById[rowId]
if (!row) {
if (process.env.NODE_ENV === 'development') {
throw new Error(`getRow could not find row with ID: ${rowId}`)
}
throw new Error()
}
}
return row
}
View on GitHub (pinned to d01c01bedb)
Solutions
- Check the row exists before calling getRow (e.g. inspect table.getRowModel().rowsById or table.getCoreRowModel().rowsById).
- Regenerate the row ID from the current row object instead of caching an old ID.
- Verify the row id resolution (getValueForKey / getRowId option) matches what you use to build IDs.
- Catch the error in production: in production builds the same condition throws a bare Error without the message.
Example fix
// before const row = table.getRow(rowId) // after const row = table.getCoreRowModel().rowsById[rowId] ?? table.getRowModel().rowsById[rowId] if (!row) return // or show fallback UI
Defensive patterns
Strategy: validation
Validate before calling
function findRowSafe(table, rowId) {
return table.getRowModel().rowsById[rowId] ?? table.getCoreRowModel().rowsById[rowId] ?? null
}
// before calling table.getRow(rowId): const row = findRowSafe(table, rowId); if (!row) return Type guard
function rowExists(table: Table<any>, rowId: string): boolean {
return rowId in table.getRowModel().rowsById || rowId in table.getCoreRowModel().rowsById
} Try / catch
try {
const row = table.getRow(rowId)
// use row
} catch {
// row not found: show fallback / refresh data
} Prevention
- Never cache row IDs across data refetches; derive them from the current row
- Confirm getRowId/row id key produces the IDs you look up
- Remember grouping/expansion changes generated row IDs
- Check rowsById before calling getRow
When it happens
Trigger: Calling table.getRow('someId') where 'someId' is not a key in the current row model's rowsById nor the core row model — e.g. stale ID after data change, wrong row id key, or an ID including grouping/expansion path segments that no longer exist.
Common situations: Storing row IDs across renders while data is refetched/filtered; expanding/grouping changes generated IDs; passing user-supplied IDs; using getRow in click handlers after rows were removed.
Related errors
AI-assisted analysis of TanStack/table@d01c01bedb (2026-08-28).
Data as JSON: /api/errors/05454200ab3719c2.
Report an issue: GitHub.