Skip to content

firebase deploy --only firestore fails with 409 error on existing indexes in firebase-tools v14.11.0 and v14.12.1 #8859

Closed

Description

@k1350

[REQUIRED] Environment info

firebase-tools: 14.11.0, 14.12.1

Platform: Ubuntu (GitHub Actions)

[REQUIRED] Test case

https://github.com/k1350/firebase-tools-bug-sample

[REQUIRED] Steps to reproduce

  1. Create a Firebase Project
  2. Create Service Account Key (json).
    • Role: Cloud Datastore Index Admin, Firebase Rules Admin
  3. Fork https://github.com/k1350/firebase-tools-bug-sample
  4. Set GitHub Actions Secret
    • GOOGLE_APPLICATION_CREDENTIALS: Base64 encoded Service Account Key (json)
    • PROJECT_ID: Firebase Project ID
  5. Run the "Deploy Firebase" workflow. It should succeed.
  6. Run the "Deploy Firebase" workflow again

[REQUIRED] Expected behavior

Deploy succeed.

Now using project ***

=== Deploying to '***'...

i  deploying firestore
i  firestore: reading indexes from firestore.indexes.json...
i  cloud.firestore: checking firestore.rules for compilation errors...
✔  cloud.firestore: rules file firestore.rules compiled successfully
i  firestore: latest version of firestore.rules already up to date, skipping upload...
i  firestore: deploying indexes...
✔  firestore: deployed indexes in firestore.indexes.json successfully for (default) database
✔  firestore: released rules firestore.rules to cloud.firestore

✔  Deploy complete!

Project Console: https://console.firebase.google.com/project/***/overview

[REQUIRED] Actual behavior

Deploy failed.

Now using project ***

=== Deploying to '***'...

i  deploying firestore
i  firestore: reading indexes from firestore.indexes.json...
i  cloud.firestore: checking firestore.rules for compilation errors...
✔  cloud.firestore: rules file firestore.rules compiled successfully
i  firestore: latest version of firestore.rules already up to date, skipping upload...
i  firestore: deploying indexes...
i  firestore: there are 1 indexes defined in your project that are not present in your firestore indexes file. To delete them, run this command with the --force flag.

Error: Request to https://firestore.googleapis.com/v1/projects/***/databases/(default)/collectionGroups/widgets/indexes had HTTP Error: 409, index already exists
Error: Process completed with exit code 1.

It’s true that the indexes already exist, but with v14.10.1, deployment completed successfully without any issues.

Activity

  1. ottob commented on Jul 17, 2025

    @ottob

    We have the same issue, maybe related to #7629?

    Maybe we have to regenerate our local firestore.indexes.json now after that PR was included in 14.11.0

  2. aalej commented on Jul 17, 2025

    @aalej
    Contributor

    Hey folks, apologies for the issue here. I'm able to reproduce the error during deployments. To workaround the issue, please temporarily downgrade to firbease-tools v14.10.1

    Let me discuss this issue with our engineering team.

  3. TorbenWetter commented on Jul 17, 2025

    @TorbenWetter
    Contributor

    Hi everyone, I've opened #8860 with a potential fix for this issue. It adjusts how __name__ fields are handled in indexes. Would appreciate if someone could review and test it!

  4. anasonline commented on Jul 20, 2025

    @anasonline

    We also started seeing the same issue.

  5. chacaleduardo commented on Jul 21, 2025

    @chacaleduardo

    same issue. version 13.35.1

  6. willemjanvankranenburg commented on Jul 22, 2025

    @willemjanvankranenburg

    @aalej any updates on this? Downgrading to 14.10.1 seems to fix this problem for now, but it we don't want to rely on downgrading and should be able to use the latest version

  7. aalej commented on Jul 22, 2025

    @aalej
    Contributor

    Sorry for the delay here. We have a fix for this in #8862 and it should be available in our next release. I will follow up with our engineering to to see when we can schedule this release

  8. willemjanvankranenburg commented on Jul 22, 2025

    @willemjanvankranenburg

    @aalej thanks for the response, can you give an ETA for when this release will be available when you know it?

  9. aalej commented on Jul 22, 2025

    @aalej
    Contributor

    Just a quick update: we are planning on getting a release out today, so the fix should be available shortly after.

    @chacaleduardo you shouldn't be encountering this issue with v13.35.1 since the error started in v14.11.0. It's possible that the cause of the issue you're encountering is different. Could you share your firebase-debug.log file with us so that we can check? Please remove any PIIs before sharing the contents.

  10. 22 remaining items

  11. salvia34 commented on Aug 19, 2025

    @salvia34

    You are correct @ehsannas ..

    For what it's worth, I was able to resolve the ...had HTTP Error: 409, index already exists error in my case. The issue was caused by a duplicate index that I had inserted into my firestore.indexes.json file. Removing the duplicate entry has resolved the error.

    My apologies for polluting the post unnecessarily.

  12. added a commit that references this issue on Aug 20, 2025
    4bdc5fe
  13. added a commit that references this issue on Aug 20, 2025
    ee10ddc
  14. arnab commented on Aug 20, 2025

    @arnab

    My deployments are still failing with the same error. Is this already fixed/released (the issue is marked as closed)?

  15. aalej commented on Aug 21, 2025

    @aalej
    Contributor

    The fix for this should be available in firebase-tools v14.13.0. I've tested this version, and running firebase deploy --only firestore:indexes isn't raising any errors. Could you try updating to this version to see if you'd still encounter the same error?

  16. jpdom commented on Sep 1, 2025

    @jpdom

    On version 14.15.1 I get the 409 error doing firebase deploy --only firestore but not if I do individually firebase deploy only firestore:indexes and then firebase deploy only firestore:rules . FYI

  17. clarkbox commented on Sep 12, 2025

    @clarkbox

    i am still seeing this error. just tested in 14.16.0. is the fix incoming?

  18. fwal commented on Sep 16, 2025

    @fwal

    Same error on 14.16.0, using firebase deploy --only firestore:indexes

  19. harripj commented on Sep 18, 2025

    @harripj

    I'm also having this error on 14.17.0 using firebase deploy --only firestore:indexes

  20. ehsannas commented on Sep 18, 2025

    @ehsannas
    Contributor

    I'm not seeing an error. Do you mind sharing your [redacted] firestore.indexes.json ?

  21. jflemingframe commented on Sep 18, 2025

    @jflemingframe

    I'm also having this error on 14.17.0 using firebase deploy --only firestore:indexes

    I made a tool for sharing your redacted firebase indices in an earlier comment, u can use it too

    Little tool made with AI, others can use
    run like this cat <json file> | node <script.js> or whatever else does stdin to the next command
    it will output to command line.
    it attempts to do some kind of verification. Didnt look through all that in gross detail, but the diff and the resulting file length makes alot of sense. good enough for us probably?
    anonymize-firebase-indexes.js.txt

  22. fwal commented on Sep 22, 2025

    @fwal

    Started working for me again after I re-pulled my indexes (which added a bunch of "density": "SPARSE_ALL")

  23. clarkbox commented on Oct 2, 2025

    @clarkbox

    Started working for me again after I re-pulled my indexes (which added a bunch of "density": "SPARSE_ALL")

    Thanks for the suggested workaround. Unfortunately, the bug persists on my end even after pulling the existing indexes and adding density to each.

    What fixed it for me was to delete all indexes (deploy empty indexes file). and then deploying the full indexes file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions