payloadcms / payloadcms/payload

`ValidationError` becomes `o` after Next.js build

Open
#13,645 4 comments 4 reactions 1 assignee View on GitHub

@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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.