Skip to content
Sites Hackathon is live / Aug 29 - Sep 12
Back

updateDocument() throws "document_already_exists" error instead of updating existing document

  • 0
  • Databases
  • Web
  • Cloud
azwar
4 Sep, 2025, 07:59

Hi guys, im using server sdk to update appwrite attribute value which relationship type. But facing "document_already_exists", may i know why?

TL;DR
Issue: The developer is encountering a "document_already_exists" error when trying to update an existing document using the `updateDocument()` function in the server SDK. Solution: The error is likely due to attempting to update a document that already exists in the database. To resolve this, ensure that the `id_dic` provided as a parameter uniquely identifies an existing document for updating, rather than creating a new one. Double-check the value of `id_dic` and verify that it corresponds to the intended document.
azwar
4 Sep, 2025, 08:00

let updated = await databases.updateDocument( process.env.APPWRITE_DATABASE_KEY || "DEFAULT_DATABASE_ID", process.env.APPWRITE_DESCENDANT_IDENTITY_CREDENTIALS || "DEFAULT_DESCENDANT_IDENTITY_CREDENTIALS", id_dic, { mobile_device: "1dcffa65-7f23-4c08-a7f2-2358d59a621e", } );

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