Skip to content

PINIA_COLADA_R0005: mutation entry mutated before being ensured ​

  • Level: error (logged, dev only)

What happened ​

mutationCache.mutate() was called with a mutation entry that was never ensured. Ensuring an entry registers it in the cache and assigns it an id; mutating an entry that skipped this step leaves the cache in an inconsistent state.

How to fix it ​

Always ensure the entry first when calling mutationCache.mutate() manually. ensure() takes the entry returned by create() plus the variables:

ts
const mutationCache = useMutationCache()
const entry = mutationCache.create(options)

// ✅ ensure first, then mutate
mutationCache.mutate(mutationCache.ensure(entry, vars))

// ❌ mutating an entry that was only created, never ensured
mutationCache.mutate(entry)

If you are not calling mutationCache.mutate() manually, this is probably a bug in Pinia Colada: please open an issue on GitHub with a boiled down reproduction.

Common causes ​

  • Calling mutationCache.mutate() with an entry obtained from create() instead of ensure()
  • Reusing internal cache APIs in plugins without going through ensure()

Released under the MIT License.