Invalid `documentId` param: UID must contain at most 36 chars. Valid chars are a-z, A-Z, 0-9, and un
- 0
- Databases
- Flutter
- Self Hosted

in Flutter App i have a class, let's call it the car class.
i create a new Car:
Car( id: ID.unique(), created: true, )
and on other place there is a function which is called: if car.created == true:
...databases.createDocument( databaseId: ENV.APPWRITE_DB, collectionId: ENV.CAR_COLLECTION, documentId: car.id, data: car.toAppwrite(), );
my problem is: i get this error in return:
AppwriteException: general_argument_invalid, Invalid documentId
param: UID must contain at most 36 chars. Valid chars are a-z, A-Z, 0-9, and underscore. Can't start with a leading underscore (400)<…>
would be great for any solutions and explanations of the reason.

What does your car ID look like ?

Would help if you print the value of car.id before you make the call to createDocument()

i get: "unique()" in return

are you able to open your app on the browser and inspect the network request?

hm, i can try to check it with the dev tools

yea that would be helpful 👍

request uri: https://appwrite.domain.com/v1/databases/alpha_db/collections/car/documents/unique() method: PATCH status: 400
request: {"data":{"title":"test2"}}
response: {"message":"Invalid documentId
param: UID must contain at most 36 chars. Valid chars are a-z, A-Z, 0-9, and underscore. Can't start with a leading underscore","code":400,"type":"general_argument_invalid","version":"1.4.13"}

You;re hitting the updateDocument
endpoint as indicated by the PATCH method

so you're trying to update a document with id unique()
which does not exist

lol you right

Hope that solves the problem ?

yes, thank you very much

No worries 👌
Recommended threads
- Cannot create a user
Hi, I am using a lowcoder frontend and trying to create a user in Appwrite (python function). Unfortunately, all I got is an error: "Raw body: Error". It means...
- Relationships restricted to a max depth ...
When I do query like: ``` await _databases.listDocuments( databaseId: AppwriteConfig.DATABASE_ID, collectionId: AppwriteConfig.SERVICES_COLLECTI...
- How can we add more than 8 attributes in...
Hey, when I tried to add attribute in my collection it showed me this Error "The maximum number or size of attributes for this collection has been reached." How...
