payloadcms / payloadcms/payload

Unable to use json field when version is on for page.

Open
#11,182 3 comments 0 reactions 1 assignee View on GitHub

@zubricks is already working on this.

Since Feb 20, 2026.

db: mongodb status: verified
Dominant language
TypeScript
Stars
44.8k
Forks
4.2k
Avg merge
2d 21h
Merged PRs (30d)
53

Description

Describe the Bug

I am trying to use a JSON field for page schemas, where it will be generated by default using the afterChange hook or user can enter the JSON data, but I get a Mongoose validation error when version (draft) mode is on. It says that cast to embed failed. It is working fine when I am removing the page versions mode.

using pnpm version-> 10.4.0

Link to the code that reproduces this issue

https://github.com/krishnasinghdev/bug-report/

Reproduction Steps

Input any json value to the schema field and click on save button.

This is will give error "something went wrong." and below error in terminal.

Image
Image

Which area(s) are affected? (Select all that apply)

area: core

Environment Info
Binaries:
  Node: 22.12.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  payload: 3.23.0
  next: 15.1.5
  @payloadcms/db-mongodb: 3.23.0
  @payloadcms/email-nodemailer: 3.23.0
  @payloadcms/graphql: 3.23.0
  @payloadcms/next/utilities: 3.23.0
  @payloadcms/payload-cloud: 3.23.0
  @payloadcms/richtext-lexical: 3.23.0
  @payloadcms/translations: 3.23.0
  @payloadcms/ui/shared: 3.23.0
  react: 19.0.0
  react-dom: 19.0.0
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Home Single Language
  Available memory (MB): 7853
  Available CPU cores: 8

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.