Describe the Bug
On the SEO tab of a document that contains an array field with a custom RowLabel component and at least one row with a populated relationship, Payload throws:
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'BasePayload'
| property 'db' -> object with constructor 'Object'
--- property 'payload' closes the circle
It throws inside PreviewComponent's useEffect while building the body for POST /api/plugin-seo/generate-url. MetaTitleField's Auto-generate button does the same
thing against /api/plugin-seo/generate-title.
reduceToSerializableFields in @payloadcms/ui calls a shallow sanitizeField helper that strips customComponents and validate only from the top-level of each field entry. Array form state has the same keys inside rows[i], and those still hold the rendered RowLabel tree.
Link to the code that reproduces this issue
https://github.com/codeplott/payloadcms-rowlabel-plugin-seo
Reproduction Steps
Clone: https://github.com/codeplott/payloadcms-rowlabel-plugin-seo
- Create a page, give it a
title and slug, save.
- Add one entry to the
links array, set label, pick the page itself (or any other page) for reference, save.
- Reload the edit view.
- The runtime error overlay shows
Converting circular structure to JSON ... BasePayload ... db ... payload.
- The SEO Preview URL stays at
https://... instead of what generateURL would produce. Clicking the MetaTitle "Auto-generate" button throws the same error.
Which area(s) are affected?
plugin: seo
Environment Info
Binaries:
Node: 24.16.0
npm: 11.15.0
pnpm: 10.33.4
Relevant Packages:
payload: 3.85.0
next: 16.2.6
@payloadcms/db-mongodb: 3.85.0
@payloadcms/graphql: 3.85.0
@payloadcms/next/utilities: 3.85.0
@payloadcms/plugin-seo: 3.85.0
@payloadcms/richtext-lexical: 3.85.0
@payloadcms/translations: 3.85.0
@payloadcms/ui/shared: 3.85.0
react: 19.2.6
react-dom: 19.2.6
Operating System:
Platform: darwin
Arch: arm64
Describe the Bug
On the SEO tab of a document that contains an array field with a custom
RowLabelcomponent and at least one row with a populatedrelationship, Payload throws:It throws inside
PreviewComponent'suseEffectwhile building the body forPOST /api/plugin-seo/generate-url.MetaTitleField's Auto-generate button does the samething against
/api/plugin-seo/generate-title.reduceToSerializableFieldsin@payloadcms/uicalls a shallowsanitizeFieldhelper that stripscustomComponentsandvalidateonly from the top-level of each field entry. Array form state has the same keys insiderows[i], and those still hold the renderedRowLabeltree.Link to the code that reproduces this issue
https://github.com/codeplott/payloadcms-rowlabel-plugin-seo
Reproduction Steps
Clone: https://github.com/codeplott/payloadcms-rowlabel-plugin-seo
titleandslug, save.linksarray, setlabel, pick the page itself (or any other page) forreference, save.Converting circular structure to JSON ... BasePayload ... db ... payload.https://...instead of whatgenerateURLwould produce. Clicking the MetaTitle "Auto-generate" button throws the same error.Which area(s) are affected?
plugin: seo
Environment Info