payloadcms / payloadcms/payload
`ValidationError` becomes `o` after Next.js build
Open
@AlessioGr is already working on this.
Since Oct 28, 2025.
status: verified
- Dominant language
- TypeScript
- Stars
- 44.8k
- Forks
- 4.2k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 53
Description
Describe the Bug
When using Payload CMS with Next.js, the error name changes after build:
- In
next dev:"name": "ValidationError" - In
next start:"name": "o"
This happens because Next.js minifies class names in production.
Solution
Disable server-side minification in next.config.js:
/** @type {import('next').NextConfig} */
const nextConfig = {
distDir: 'dist',
experimental: {
serverMinification: false,
},
}
https://github.com/vercel/next.js/issues/59594
Link to the code that reproduces this issue
https://github.com/payloadcms/payload/blob/main/.github/reproduction-guide.md
Reproduction Steps
next build
Which area(s) are affected? (Select all that apply)
area: core
Environment Info
"@payloadcms/db-postgres": "^3.50.0",
"@payloadcms/next": "^3.50.0",
"@payloadcms/ui": "^3.50.0",
"next": "15.1.5",
"payload": "^3.50.0",
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.