Skip to content
Back

Help with 409 Error on Relationship Setup in Appwrite Console

  • 0
  • Databases
  • REST API
  • Web
  • Cloud
Mubarak SULAYMAN
5 Jul, 2025, 14:27

I ran into a 409 document_already_exists issue. with AppWrite so I tried to debug. Here's what I've set up:

Collection A has 3 attributes and a two-way 1-to-many relationship with Collection B Collection B currently has no attributes

When I try to create a document, I get this: { "message": "Document with the requested ID already exists. Try again with a different ID or use ID.unique() to generate a unique ID.", "code": 409, "type": "document_already_exists", "version": "1.7.4" }

I have confirmed that I am not reusing IDs manually, so I suspect the issue is linked to how Appwrite handles relationship constraints under the hood. Has anyone run into something similar? Is there a specific way to structure the relationship doc creation to avoid this? All other help I found around 409 error has no clear note on how the issue was resolved and what directly caused it.

Any pointers would be appreciated. Thank you!

TL;DR
Issue: 409 Error - Document already exists in Appwrite Console when setting up relationships between two collections. - Developer encountered a document_already_exists issue while creating a document with a 1-to-many relationship setup between Collection A and Collection B in AppWrite. - The error code is 409 with a message suggesting to use a different ID or ID.unique() because the document already exists. - Suspects the error is related to how Appwrite handles relationship constraints internally and seeks guidance on how to structure relationship document creation to avoid the error. Solution: Ensure that the document IDs are unique and consider using ID.unique() to generate unique IDs to prevent
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more