Skip to content

PINIA_COLADA_R0004: entry has no options ​

  • Level: error (thrown, dev only)

What happened ​

queryCache.refresh(entry) or queryCache.fetch(entry) was called with an entry that has no options. Entries only receive options once they are used by useQuery() (or ensured with options); entries created indirectly (e.g. by setQueryData() on a key that was never used by a query) cannot be fetched because there is no query function associated with them.

How to fix it ​

Only refresh or fetch entries that have been initialized by a query:

ts
const queryCache = useQueryCache()

const entry = queryCache.getEntries({ key: ['todos'], exact: true }).at(0)
// only fetch entries that have options
if (entry?.options) {
  await queryCache.refresh(entry)
}

If the entry was expected to have options, this is probably a bug in Pinia Colada: please open an issue with a boiled down reproduction.

Common causes ​

  • Calling queryCache.fetch()/queryCache.refresh() on an entry created only via setQueryData() or hydration
  • Iterating over all entries with getEntries() and fetching them without filtering out option-less entries

Released under the MIT License.