Back

Document with the requested ID already exists

  • 0
  • Functions
  • Cloud
Chandan Gowda
2 Apr, 2024, 10:19

Traceback (most recent call last): File "/usr/local/server/src/function/runtime-env/lib/python3.9/site-packages/appwrite/client.py", line 100, in call response.raise_for_status() File "/usr/local/server/src/function/runtime-env/lib/python3.9/site-packages/requests/models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 409 Client Error: Conflict for url: https://cloud.appwrite.io/v1/databases/654232d47fca4f8eea13/collections/6555ffc479954d772227/documents

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/server/src/server.py", line 163, in action output = await asyncio.wait_for(execute(context), timeout=safeTimeout) File "/usr/local/lib/python3.9/asyncio/tasks.py", line 479, in wait_for return fut.result() File "/usr/local/server/src/server.py", line 156, in execute output = userModule.main(context) File "/usr/local/server/src/function/src/main.py", line 96, in main database.create_document(MASTER_DATABASE_ID, LEADERBOARD_COLLECTION_ID, ID.unique(), data={ File "/usr/local/server/src/function/runtime-env/lib/python3.9/site-packages/appwrite/services/databases.py", line 945, in create_document return self.client.call('post', api_path, { File "/usr/local/server/src/function/runtime-env/lib/python3.9/site-packages/appwrite/client.py", line 112, in call raise AppwriteException(response.json()['message'], response.status_code, response.json().get('type'), response.json()) appwrite.exception.AppwriteException: Document with the requested ID already exists. Try again with a different ID or use ID.unique() to generate a unique ID.

TL;DR
Developer is encountering a 'Document with the requested ID already exists' error. It is suggested to verify the SDK version and ensure they are using 'ID.unique()' to generate unique IDs.
ideclon
2 Apr, 2024, 10:22

If you run this again, does the same error happen?

Chandan Gowda
2 Apr, 2024, 10:23

Nope

Chandan Gowda
2 Apr, 2024, 10:23

I’ve got this once

ideclon
2 Apr, 2024, 10:23

And you are using ID.unique(), right?

ideclon
2 Apr, 2024, 10:25

What version of the SDK are you using?

Chandan Gowda
2 Apr, 2024, 10:33

Yeahh

Chandan Gowda
2 Apr, 2024, 10:33

Cloud function

Chandan Gowda
2 Apr, 2024, 10:33

Python sdk

ideclon
2 Apr, 2024, 10:34

What version of the SDK are you using?

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