---
url: /errors/pinia_colada_r0008.md
---
# PINIA\_COLADA\_R0008: missing getPreviousPageParam

* Level: error (thrown, dev only)

## What happened

`loadPreviousPage()` was called on an infinite query that does not define `getPreviousPageParam` in its options. Without it, Pinia Colada cannot compute the parameter of the previous page. **This will fail in production** where the development check is removed.

## How to fix it

Add a `getPreviousPageParam()` function to the `useInfiniteQuery()` options:

```ts
useInfiniteQuery({
  key: ['messages'],
  query: ({ pageParam }) => fetchMessages({ cursor: pageParam }),
  initialPageParam: null as string | null,
  getNextPageParam: (lastPage) => lastPage.nextCursor,
  getPreviousPageParam: (firstPage) => firstPage.previousCursor, // [!code ++]
})
```

## Common causes

* Calling `loadPreviousPage()` on a query that only paginates forward
* Forgetting `getPreviousPageParam` when adding bidirectional pagination
