{"record":{"id":"38d07e3a10039482","repo":"TanStack/query","slug":"provided-storage-does-not-implement-entries-meth-38d07e","errorCode":null,"errorMessage":"Provided storage does not implement `entries` method. Removal of stored entries is not possible without ability to iterate over storage items.","messagePattern":"Provided storage does not implement `entries` method\\. Removal of stored entries is not possible without ability to iterate over storage items\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/query-persist-client-core/src/createPersister.ts","lineNumber":357,"sourceCode":"            persistedQuery = await deserialize(value)\n          } catch {\n            await storage.removeItem(key)\n            continue\n          }\n\n          if (exact) {\n            if (persistedQuery.queryHash !== hashKey(queryKey)) {\n              continue\n            }\n          } else if (!partialMatchKey(persistedQuery.queryKey, queryKey)) {\n            continue\n          }\n\n          await storage.removeItem(key)\n        }\n      }\n    } else if (process.env.NODE_ENV === 'development') {\n      throw new Error(\n        'Provided storage does not implement `entries` method. Removal of stored entries is not possible without ability to iterate over storage items.',\n      )\n    }\n  }\n\n  return {\n    persisterFn,\n    persistQuery,\n    persistQueryByKey,\n    retrieveQuery,\n    persisterGc,\n    restoreQueries,\n    removeQueries,\n  }\n}\n","sourceCodeStart":339,"sourceCodeEnd":373,"githubUrl":"https://github.com/TanStack/query/blob/159982c80b844487054155c38ffc760fe4208daf/packages/query-persist-client-core/src/createPersister.ts#L339-L373","documentation":"Dev-only error from `removeQueries` in `createPersister`. Removing persisted entries by filter requires iterating all stored keys; if `storage` lacks `entries()`, the operation cannot run and fails loudly in development (silently skipped in production).","triggerScenarios":"Calling `removeQueries()` (or the persister's bulk-remove path) with a storage that does not implement `entries()`; custom minimal storage adapters; passing a storage stub in tests.","commonSituations":"AsyncStorage variants; partial polyfills; test doubles that only mock `getItem`/`setItem`/`removeItem`; adapters targeting a key-value interface without enumeration.","solutions":["Implement `entries()` on the storage so the filter can scan all keys.","Use a storage with native enumeration support (`localforage`, `Map`).","Remove entries by explicit key with `storage.removeItem(prefix + hashKey(queryKey))` instead of the bulk filter.","Decide whether production's silent skip is acceptable for your use case."],"exampleFix":"// before\nconst persister = createPersister({ storage: asyncStorage })\nawait persister.removeQueries({ queryKey: ['todos'] })\n// after\nconst storage = { ...asyncStorage, entries: async () => { /* return [k,v] pairs */ } }\nconst persister = createPersister({ storage })\nawait persister.removeQueries({ queryKey: ['todos'] })","handlingStrategy":"validation","validationCode":"function assertCanRemove(storage: any) {\n  if (!storage || typeof storage.entries !== 'function') {\n    throw new Error('removeQueries needs storage.entries()')\n  }\n}","typeGuard":"const canEnumerate = (s: any): s is { entries(): Promise<Iterable<[string, any]>> } =>\n  !!s && typeof s.entries === 'function'","tryCatchPattern":"try { await persister.removeQueries({ queryKey }) } catch (e) { if (/entries method/.test((e as Error).message)) console.warn('remove skipped:', e.message) }","preventionTips":["Provide a storage that implements `entries()`.","When enumeration is impossible, remove by explicit hashed key instead.","Document the storage contract for adapter authors.","Verify behavior in both dev and production (production skips silently)."],"tags":["persister","storage","remove","validation","dev-only"],"backgroundTag":null,"analyzedSha":"159982c80b844487054155c38ffc760fe4208daf","analyzedAt":"2026-08-12T16:21:52.822Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}