Skip to content

Firebase errorFirebase: app/duplicate-app, “Firebase App named ‘[DEFAULT]’ already exists with different options”

app/duplicate-app is the Firebase error for calling initializeApp a second time with the same app name but a different configuration. Setup code that runs more than once, such as server rendering, hot reload or two config files, is a common way to end up with two different configs.

Short answer

Initialize Firebase in one module and reuse it: check getApps() first, and return the existing app with getApp() if one is already set up. Make sure every place that initializes Firebase uses the same config, and give a second project its own app name.

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 Firebase sees two different configs, and the fix

  1. 01

    The setup code runs more than once

    “If a FirebaseApp already exists with the same name but with a different configuration.” Firebase, Firebase JS SDK reference: initializeApp (Exceptions)

    Server rendering, hot reload or importing the setup from two entry points can call initializeApp again. With identical config the SDK just returns the existing app; it throws only when the options or config differ between calls. Guard the call with getApps() and getApp() so one config is used everywhere.

    import { initializeApp, getApps, getApp } from 'firebase/app';
    
    export const app = getApps().length ? getApp() : initializeApp(firebaseConfig);
  2. 02

    Two configs for the same app

    A config file and environment variables, or a staging and a production config, loaded in the same app clash on the default name. The SDK’s error message names the setting that differs and shows the existing and the new value, so compare them and keep one.

  3. 03

    A second project needs its own name

    Using two Firebase projects in one app is allowed, but each needs a separate app name. Pass a name as the second argument for the extra project.

    const analyticsApp = initializeApp(otherConfig, 'analytics');
  4. 04

    The same error in Flutter

    Also check: in Flutter the same error reads [core/duplicate-app]. FlutterFire throws it only when the options passed to Firebase.initializeApp differ from an app that already exists, including a default app created on the native side. Make the Dart options match the platform config files, and give a second project its own app name.

Checked against the vendor’s docs on : Firebase JS SDK reference: firebase/app; Firebase JS SDK source: app errors; Firebase JS SDK source: initializeApp; FlutterFire source: firebase_core initializeApp.

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: Firebase No App [DEFAULT] has been created · Firebase invalid API key in production · FlutterFire configure FirebaseCommandException · Firebase auth/unauthorized-continue-uri

Questions

More on this error

Is it the same as “No Firebase App [DEFAULT] has been created”?

No, it is the opposite. That error means Firebase was never initialized; duplicate-app means it was initialized twice with different settings.

Should I call deleteApp and start again?

Rarely. Reusing the existing app with getApp is simpler and avoids losing the state of services already running.

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.