Repository navigation
Open
Labels
BugPayload OSSplugin: seo@payloadcms/plugin-seostatus: needs-triagePossible bug which hasn't been reproduced yetv3
Description
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
Reproduction Steps
- Create a page, give it a
titleandslug, save. - Add one entry to the
linksarray, setlabel, pick the page itself (or any other page) forreference, 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 whatgenerateURLwould 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
Reacted by Px Cheah, Mike Ambrozaitis and Teemu Suvinen
Metadata
Metadata
Assignees
Labels
BugPayload OSSplugin: seo@payloadcms/plugin-seostatus: needs-triagePossible bug which hasn't been reproduced yetv3
Activity
[-]plugin-seo: PreviewField throws "circular structure to JSON"[/-][+]plugin-seo & ui: PreviewField throws "circular structure to JSON"[/+]drianoaz commentedon Oct 7, 2026
Still reproducible on 3.90.2 (
payload,@payloadcms/ui,@payloadcms/plugin-seo3.90.2,next16.3.8,react19.3.0, Node 24.21.0).Two data points that may help triage:
No
relationshipis needed. Our array only has aselectand atextfield, plus a client-onlyRowLabel('use client', readsuseRowLabel()):Clicking the MetaTitle "Auto-generate" button throws before the request is sent. The offending path in the body is
initialState.layout.0.availability.rows.0.customComponents.RowLabel._payload.value._owner.props.payload.It only happens in development. In dev, React attaches
_owner(debug info) to the RSC-renderedRowLabelelement, and that owner's props include thepayloadinstance. In a production build there's no_owner, soJSON.stringifysucceeds. The renderedRowLabeltrees are still sent in the body there, though (around 400 KB on one of our documents), so the root cause is the same.The fix looks like making
sanitizeFieldinpackages/ui/src/forms/Form/reduceToSerializableFields.tsalso stripcustomComponents/validatefrom eachrows[i]of array and blocks fields.fix(ui): remove nested row components when reducing form state to ser…