P
Prisma•4mo ago
vpjm

P2022 : The column `colonne` does not exist in the current database.

The column is probably named 'colonne' because I'm French, but at no point in my code do I have a column named 'colonne'
→ 56 await prisma.user.create(
The column `colonne` does not exist in the current database.
at Zn.handleRequestError (---\node_modules\@prisma\client\runtime\library.js:121:7459)
at Zn.handleAndLogRequestError (---\node_modules\@prisma\client\runtime\library.js:121:6784)
at Zn.request (---\node_modules\@prisma\client\runtime\library.js:121:6491)
at async l (---\node_modules\@prisma\client\runtime\library.js:130:9778)
at seed (---\db\prisma\src\seed\index.ts:56:5)
at main (---\db\prisma\src\seed\index.ts:85:9) {
code: 'P2022',
meta: { modelName: 'User', column: 'colonne' },
clientVersion: '6.7.0'
}
→ 56 await prisma.user.create(
The column `colonne` does not exist in the current database.
at Zn.handleRequestError (---\node_modules\@prisma\client\runtime\library.js:121:7459)
at Zn.handleAndLogRequestError (---\node_modules\@prisma\client\runtime\library.js:121:6784)
at Zn.request (---\node_modules\@prisma\client\runtime\library.js:121:6491)
at async l (---\node_modules\@prisma\client\runtime\library.js:130:9778)
at seed (---\db\prisma\src\seed\index.ts:56:5)
at main (---\db\prisma\src\seed\index.ts:85:9) {
code: 'P2022',
meta: { modelName: 'User', column: 'colonne' },
clientVersion: '6.7.0'
}
I've pushed, generated, dropped all, reset, and migrated countless times. "prisma": "^6.8.2",
3 Replies
Prisma AI Help
Prisma AI Help•4mo ago
Skipping coffee for instant knowledge! Let's brew that AI answer now. The P2022 error, "The column colonne does not exist in the current database," means Prisma is trying to access a column named colonne, but your database does not have this column. This can happen even if you don't see colonne in your Prisma schema or code, often due to schema drift or a mismatch between your Prisma schema and the actual database structure. Based on similar issues, here are some possible causes and solutions: 1. Schema Drift or Migration Issues
If you renamed, added, or removed columns directly in the database (outside of Prisma migrations), Prisma might still expect the old column. Running prisma db pull only updates your schema, not the actual database structure. Make sure your database and Prisma schema are in sync. Try running:
npx prisma migrate reset

npx prisma migrate reset

This will reset your database and apply all migrations from scratch. Be aware: this deletes all data. 2. Stale Prisma Client
After any schema change, always run:
npx prisma generate

npx prisma generate

to regenerate the client. 3. Column Name Mapping
If you use @map("colonne") in your Prisma schema, Prisma will look for colonne in the database, even if your model field is named differently. Double-check your schema for any @map or @@map attributes. 4. Database Not Updated
If you use prisma db push or migrations, but the database is not actually updated (e.g., wrong database URL, permissions), Prisma will still expect the new structure. Double-check your connection and migration logs. 5. Case Sensitivity or Encoding
Especially with non-English column names, encoding or case mismatches can cause Prisma to not find the column, even if it exists. Check your database directly for the exact column name and encoding. If you have tried all of the above and the issue persists, please check for any manual changes in your database or share your Prisma schema and migration history for further troubleshooting. References:
- Prisma error code P2022 docs - Similar issue after renaming columns - Schema drift and migration issues šŸ¤” 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.
Nurul
Nurul•4mo ago
Did you try regenerating your PrismaClient with npx prisma generate?
vpjm
vpjmOP•4mo ago
Yes, it doesn't work. The problem is that this error could mean anything, and it takes me a lot of time to manually check everything to figure out what's wrong. But its fixed now thanks ! 🫶

Did you find this page helpful?