Skip to content
Back

Error 409 : Document with the requested ID already exists

  • 0
  • Databases
  • Web
Maxou
10 Apr, 2025, 22:01

If one document is in DB, every other attempt will have a 409. I only have userId that is required, no index, no relation

My code :

TypeScript
databaseService
        .createDocument(
          env.appwrite.db.id,
          env.appwrite.db.collection.userdata,
          ID.unique(),
          dataWithoutUserName
        )

An example a payload : {"documentId":"67f83f3e001deb9d46da","data":{"roles":[],"city":"Paris","userId":"679d2f914100ccaad8e6"}} (documentId is different at each request)

TL;DR
Error 409 occurs when trying to create a document with an existing ID in the database. The issue is because a unique ID is not generated for each request. To fix this, ensure a unique ID is generated for each document creation to avoid conflicts.
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