Skip to content
Back

Row with the requested ID already exists.

  • 0
  • Databases
  • React Native
  • Cloud
SeneMansa
17 Sep, 2025, 00:12

I’m hitting a blocking issue creating rows in Appwrite (both from the console and my React Native app). After successfully inserting the first row, every subsequent create fails with:

[AppwriteException: Row with the requested ID already exists. Try again with a different ID or use ID.unique() to generate a unique ID.]

It looks like the document ID is being treated as already used even when I expect a new unique ID. I only have one two-way one-to-one relationship between two tables. After the first insert, I can’t add any more records.

Schema (essential parts):

Table: profiles

  • Columns: gender (enum: male|female), dob (datetime, required), marketingoptin (bool), userid (string, size 36, required), fullname (string, 128, required), email (string, 254), phonee164 (string, 32, required), locale (string, 8, required), profilepicture (url)
  • Relationship: secure_idprofiles_secure (oneToOne, twoWay=true, twoWayKey=profileid, onDelete=cascade, side=child)
  • Permissions: read("users")
  • Indexes: none

Table: profiles_secure

  • Columns: pregnancystatus (enum: na|pregnant|postpartum), breastfeeding (bool), cninumber (string, 32), allergies (string], 128), emergencycontactname (string, 128), emergencycontactphonee164 (string, 32), consents (string, 4096)
  • Relationship: profile_idprofiles (oneToOne, twoWay=true, twoWayKey=secureid, onDelete=cascade, side=parent)
  • Permissions: read("users")
  • Indexes: indexcni (ASC)

Notes:

  • The error occurs immediately after the first profiles row is added.
  • I expected Appwrite to generate a unique document ID (or to honor ID.unique()), but the platform behaves as if the same ID is reused.
  • Only change since it worked: adding the two-way one-to-one relation above.

Any ideas why additional creates are hitting “Row with the requested ID already exists”? Is there something about two-way one-to-one relations or document IDs I might be misconfiguring?

TL;DR
Developers encountered an issue where creating a row resulted in an error message indicating the ID already exists. They found a solution by switching from a two-way one-to-one relationship to a one-to-many structure, resolving the duplicate ID errors. The error stemmed from a misconfiguration in the relationship setup.
SeneMansa
17 Sep, 2025, 00:29

<@462046107556511744> Do you know why this is happening at the moment I see same issue was posted earlier with no response from the team https://discord.com/channels/564160730845151244/1415039983844327476

SeneMansa
17 Sep, 2025, 01:07

@Steven Resolved: the issue was my prior relationship config. Switched to parent→child one-to-many; working now. Updated schemas (minified):

profiles:

{"$id":"profiles","$permissions":["read(users)"],"databaseId":"68bdaf5e001c607946d7","name":"Profiles","enabled":true,"columns":[{"key":"gender","type":"string","format":"enum","elements":["male","female"]},{"key":"dob","type":"datetime","required":true},{"key":"marketing_opt_in","type":"boolean","default":false},{"key":"user_id","type":"string","required":true,"size":36},{"key":"full_name","type":"string","required":true,"size":128},{"key":"email","type":"string","size":254},{"key":"phone_e164","type":"string","required":true,"size":32},{"key":"locale","type":"string","required":true,"size":8},{"key":"profile_picture","type":"string","format":"url"},{"key":"secure_id","type":"relationship","relatedTable":"profiles_secure","relationType":"oneToMany","twoWay":true,"twoWayKey":"profile_id","onDelete":"cascade","side":"parent"}],"indexes":[]}

profiles_secure:

{"$id":"profiles_secure","$permissions":["read(users)"],"databaseId":"68bdaf5e001c607946d7","name":"Profiles Secure","enabled":true,"columns":[{"key":"pregnancy_status","type":"string","format":"enum","elements":["na","pregnant","postpartum"]},{"key":"breastfeeding","type":"boolean"},{"key":"cni_number","type":"string","size":32},{"key":"profile_id","type":"relationship","relatedTable":"profiles","relationType":"oneToMany","twoWay":true,"twoWayKey":"secure_id","onDelete":"cascade","side":"child"},{"key":"allergies","type":"string","array":true,"size":128},{"key":"emergency_contact_name","type":"string","size":128},{"key":"emergency_contact_phone_e164","type":"string","size":32},{"key":"consents","type":"string","size":4096}],"indexes":[]}

TL;DR: moving from two-way 1–1 to parent(profiles)→child(profiles_secure) 1–many fixed duplicate-ID errors.

ideclon
18 Sep, 2025, 21:59

This issue usually means you're trying to create a Row with a conflicting Unique Index. It's a bad error message.

inam
12 Nov, 2025, 15:28

It happened for me because I clicked on AI feature but now I made table again with same id and columns it worked.

BartoszY
23 Dec, 2025, 21:21

I also had to create the table again

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