RecursionError When Accessing /contents page of a Folder via Volto
Describe the bug
I am trying to view the contents page of a folder (lets call it plone-folder) in Volto. the plone-folder contain migrated content-types from plone 4. The plone-folder/contents page works in classic backend without any issues. The view works, however the only issue is when I try to access the /contents page of plone-folder.
<site-address>/plone-folder/contents
This effects:
- copy/paste into/from the folder within volto
- Search to link a file within a folder from somewhere else within volto
To Reproduce Steps to reproduce the behavior:
- Happens on some migrated folders that contains content-types migrated from Plone 4.
- Problem do not appear on Classic Plone 6 Configurations. Contents & View Works.
- Problem appear when accessing
/contentsin Volto. Folder view works.
Expected behavior A clear and concise description of what you expected to happen.
Screenshots
BACKEND CLIENT:
2023-04-11 04:32:58,036 ERROR [Zope.SiteErrorLog:35][waitress-1] RecursionError: http://localhost:3003/standards-
documents/corrupt-files/@search
Traceback (innermost last):
Module ZPublisher.WSGIPublisher, line 167, in transaction_pubevents
Module ZPublisher.WSGIPublisher, line 376, in publish_module
Module ZPublisher.WSGIPublisher, line 271, in publish
Module ZPublisher.mapply, line 85, in mapply
Module ZPublisher.WSGIPublisher, line 68, in call_object
Module plone.rest.service, line 22, in __call__
Module plone.restapi.services, line 19, in render
Module plone.restapi.services.search.get, line 10, in reply
Module plone.restapi.search.handler, line 93, in search
Module plone.restapi.serializer.catalog, line 60, in __call__
Module plone.restapi.serializer.summary, line 105, in __call__
Module plone.restapi.serializer.converters, line 68, in json_compatible
Module zope.component.hooks, line 135, in adapter_hook
Module plone.restapi.serializer.converters, line 101, in list_converter
Module plone.restapi.serializer.converters, line 68, in json_compatible
Module zope.component.hooks, line 135, in adapter_hook
Module plone.restapi.serializer.relationfield, line 21, in relationvalue_converter
...
Module plone.restapi.serializer.summary, line 105, in __call__
Module plone.restapi.serializer.converters, line 68, in json_compatible
Module zope.component.hooks, line 135, in adapter_hook
Module plone.restapi.serializer.converters, line 101, in list_converter
Module plone.restapi.serializer.converters, line 68, in json_compatible
Module zope.component.hooks, line 135, in adapter_hook
Module plone.restapi.serializer.relationfield, line 21, in relationvalue_converter
Module plone.restapi.serializer.summary, line 105, in __call__
RecursionError: maximum recursion depth exceeded while calling a Python object
FRONTEND CLIENT:
Returns: Status Code: 500 Internal Server Error
Request Being Sent From Volto:
- Turning off
metadata_fieldsreturns 200.
Software (please complete the following information):
- OS: Any
- Browser: Any
- Volto Version: Volto 16.6.0
- Plone Version [e.g. 5.2.2]: Plone 6.0.0
- Plone REST API Version: plone.restapi 8.32.6
UPDATE
The underlying issue that is causing the RecursionError in my case is circular dependency between objects connected through Relations in a custom content-type design.
-
For Example, this is a definition of a custom content-type schema, having a RelationList attribute called
RelatedItemsclass IType: // RelatedItems relatedItems = RelationList( title=_(u"Related Items"), description=_(u"One or more links to related items"), required=False, ) -
Now when I create 2 new Files of IType with the following connections:

I get the error when accessing the Folder that contains those 2 objects. The error tracks to <Plone-Site>/backend/lib64/python3.9/site-packages/plone/restapi/serializer/summary.py
-
Code Error:
relatedItemsis inself.metadata_fields()on line 102 and not being ignored on line 104
-
Logs:

Creating a Relation List using 18.6. Creating content types TTW will not in self.metadata_fields() - thus it will not fire json_compatible()
- Issue reproduced on newer version of Plone.
Hey there ! I wanna work on this but I can't find in which folder or file are u describing ?
@FarooqAlaulddin does this issue occur with the latest Volto? Perhaps check the Release Notes to see if the issue has been addressed.
@Ashutosh-Singh-10 this might have been solved already. Please read and follow Contributing to Plone and First-time contributors.
@Ashutosh-Singh-10 I believe: Problem seem to appear when a content-type file has multiple (14+) RelatedItems property that contain a link to other content-types files (not a regular.pdf for example) which in turn may contain a link to the same file of the search or other files of the same content-type. This way the @search endpoint will keep exploring all possibilities since metadata_fields=_all Plone Rest API - metadata_fields setting it to relatedItems or _all would cause the problem.
// RelatedItems
RelatedItems = RelationList(
title=_(u"Related Items"),
description=_(u"One or more links to related items"),
required=False,
)
@stevepiercy I am not sure if I miss anything but I went through the bug fixes in the release notes and I did not see a similar issue title. Currently trying to test on newer version.
@FarooqAlaulddin has this been resolved with a recent release of Volto? There have been numerous bugfixes since you initially reported this issue.
@stevepiercy This is not a volto issue. It's an issue in plone.restapi if relatedItems is included in the summary metadata fields and there are items that create a cycle of relatedItems references.