Prisma Studio Error
Hello guys, asking here because it's a bit urgent.
I'm trying to connect
With prisma studio, but i'm getting
Argument connect of type UserWhereUniqueInput needs at least one of id or userId arguments. Available options are marked with ?.
19 Replies
Skipping coffee for instant knowledge! Let's brew that AI answer now.
Based on the information provided in your question and the knowledge sources available, I can offer some insights into the error you're encountering with Prisma Studio.
The error message you're seeing suggests that when trying to create or connect a Freelancer to a User in Prisma Studio, you're not providing the required unique identifier for the User model.
According to your schema, the User model has two potential unique identifiers:
1.
id
: An auto-incrementing integer
2. userId
: A unique string
When creating a Freelancer and trying to connect it to a User in Prisma Studio, you need to provide either the id
or the userId
of the User you want to connect to.
This error is similar to issues described in Github Issue: Unexpected non-type-safety in findUnique
and Github Issue: Runtime error that occurs in findUnique()
when unique constraint is composed of one field, where Prisma expects at least one unique identifier to be provided in operations involving relations.
To resolve this issue in Prisma Studio:
1. When creating a new Freelancer, make sure to fill in the userId
field with the userId
of an existing User.
2. Alternatively, you could use the id
of an existing User if you prefer.
If you're still encountering issues after ensuring you've provided a valid unique identifier, you might want to try the following:
1. Regenerate your Prisma Client to ensure it's up to date with your schema:
2. Verify that your database schema matches your Prisma schema by running:
If the problem persists after these steps, it might be worth checking if there are any inconsistencies between your Prisma schema and the actual database schema.
🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly.
In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.Hi @FrancyMak
Within the Prisma Studio interface, are you entering a value for userId in Freelancer tabe that has a corresponding id in User table
Hello! So I did this:
- Created a user record in the User model which worked fine
- Saved the changes
- Switched to the freelancer model and I tried to create the freelancer profile by adding a record and entering the same user id that I used in the user schema
But when I try to save the values I get that error
It’s kinda weird, because if I set the relation as int id it works fine
So instead of [userId] I set [id] on both
I’m using prisma Postgres, just to add more info
Instead of entering the userId, can you click on the User relation and check the id field as shown in the image

It just shows the empty freelancer model

Can you open the freelancer table in a new tab? Once its open you see the same interface as the image i shared
Sure
Sorry but I can’t create a record in that tab
Like you did
Freelancer table is empty, if I try to connect the user to the freelancer table I get the error
Looks like you have a record in your example
I just switched to a local Postgres instance and I get the same issue
The error modal is also bugged btw


Mhh i have these entries now
looks like the relation is not completed
but a record is sort of created?
idk

If I click on open in a new tab, it does nothing
[
{
"modelName": "Freelancer",
"operation": "create",
"args": {
"data": {
"user": {
"connect": {}
},
"avgRating": 0,
"departments": {},
"commissions": {},
"updatedAt": "2025-01-31T18:22:38.740Z"
},
"select": {
"id": true,
"userId": true,
"user": true,
"avgRating": true,
"departments": true,
"commissions": true,
"createdAt": true,
"updatedAt": true
}
}
}
]
When i save the changes, i get this query
Maybe
i'm trying to share a recording of how i performed the operation in Prisma Studio
Ok
Ok i did the same thing
And i have a relation now

So i can't connect the two records by entering the userId of the relation in prisma studio