Skip to content

Firestore web errorFirestore: “Failed to obtain exclusive access to the persistence layer”

Failed to obtain exclusive access is the Firestore web error when a second tab opens an app that uses single-tab persistence. Only one tab can own the IndexedDB cache in that mode, so the other tab logs this error and falls back to a memory cache with no offline data.

Short answer

Initialize Firestore with persistentLocalCache and persistentMultipleTabManager so every tab shares the cache. Replace enableIndexedDbPersistence, which is obsolete, and use the same settings in every tab. Call initializeFirestore once, before any other Firestore call.

Rather not fix it yourself? App Fix Ticket starts with a fixed-price diagnosis, then a fixed price for the fix before any fix work.

Why the second tab can’t get the cache, and the fix

  1. 01

    The app uses single-tab persistence

    “Defaults to single-tab persistence if no tab manager is specified.” Firebase, Access data offline (web)

    persistentLocalCache with no tab manager is single-tab. The second tab keeps working, but without offline data, and its cache isn’t shared. Pass persistentMultipleTabManager so all tabs share the cache.

    import { initializeFirestore, persistentLocalCache, persistentMultipleTabManager } from 'firebase/firestore';
    
    const db = initializeFirestore(app, {
      localCache: persistentLocalCache({ tabManager: persistentMultipleTabManager() }),
    });
  2. 02

    The code still calls enableIndexedDbPersistence

    “The app is already open in another browser tab.” Firebase, enableIndexedDbPersistence (failed-precondition)

    The older call is single-tab and rejects with failed-precondition when the app is already open in another tab. Firebase marks it obsolete; move to localCache in initializeFirestore.

  3. 03

    Old and new settings are mixed

    “Calling this function when FirestoreSettings.localCache is already specified will throw an exception.” Firebase, enableIndexedDbPersistence

    Calling enableIndexedDbPersistence or enableMultiTabIndexedDbPersistence after setting localCache throws. Keep only the localCache setting.

  4. 04

    Tabs use different persistence settings

    Also check: the full message mentions experimentalForceOwningTab, the older option that makes one tab take the cache without checking (persistentSingleTabManager with forceOwnership in the new API). With it, only one tab may have persistence on at a time. Remove it and use persistentMultipleTabManager in every tab.

Checked against the vendor’s docs on : Firebase docs: Access data offline; Firebase JS reference: firestore.

Rather hand it over?

Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.

“Very responsive, attentive to fixing bugs, and completed the project as needed! Thank you!”
A buyer in the United States, July 2022. Shopify on Fiverr
All 127 Fiverr reviews

Related: Firestore client is offline · Firestore deadline exceeded · Firestore quota exceeded · Cloud Firestore API disabled

Questions

More on this error

Is offline persistence on by default on the web?

No. On the web Firestore uses a memory cache unless you set persistentLocalCache. Android and Apple apps have persistence on by default.

Does persistence work in every browser?

No. Firebase says web persistence works only in Chrome, Safari and Firefox. Elsewhere it fails with unimplemented, and Firestore keeps working without the offline cache.

Can you fix it for me?

If one bug is the whole problem, the App Fix Ticket covers it: a written diagnosis first, then the fix. If the app has more going on, the Launch Check is a written check of the whole app. Each issue found is rated critical, high, medium or low, with where it is and how it was confirmed. No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.

A different error?

Describe it and get a written quote

Send the error and what you were doing. You get a written scope, a fixed price and a timeline; Simon replies by email, usually within one business day.