I received this error because of some issues with portal catalog. A folder containing images was deleted but the catalog was not updated correctly. my-obj-path was just one of the 899 images.
1/6/2025 10:06:56 AMTraceback (innermost last):
1/6/2025 10:06:56 AM Module ZPublisher.WSGIPublisher, line 181, in transaction_pubevents
1/6/2025 10:06:56 AM Module ZPublisher.WSGIPublisher, line 391, in publish_module
1/6/2025 10:06:56 AM Module ZPublisher.WSGIPublisher, line 285, in publish
1/6/2025 10:06:56 AM Module ZPublisher.mapply, line 98, in mapply
1/6/2025 10:06:56 AM Module ZPublisher.WSGIPublisher, line 68, in call_object
1/6/2025 10:06:56 AM Module plone.rest.service, line 21, in __call__
1/6/2025 10:06:56 AM Module plone.restapi.services, line 19, in render
1/6/2025 10:06:56 AM Module plone.restapi.services.search.get, line 10, in reply
1/6/2025 10:06:56 AM Module plone.restapi.search.handler, line 100, in search
1/6/2025 10:06:56 AM Module plone.restapi.serializer.catalog, line 61, in __call__
1/6/2025 10:06:56 AM Module clms.addon.restapi.summary_serializer, line 178, in __call__
1/6/2025 10:06:56 AM Module plone.app.contentlisting.catalog, line 49, in __getattr__
1/6/2025 10:06:56 AM Module plone.app.contentlisting.catalog, line 70, in getObject
1/6/2025 10:06:56 AM Module Products.ZCatalog.CatalogBrains, line 91, in getObject
1/6/2025 10:06:56 AM Module OFS.Traversable, line 364, in restrictedTraverse
1/6/2025 10:06:56 AM Module OFS.Traversable, line 347, in unrestrictedTraverse
1/6/2025 10:06:56 AM - __traceback_info__: ([], 'my0')
1/6/2025 10:06:56 AM Module OFS.Traversable, line 301, in unrestrictedTraverse
1/6/2025 10:06:56 AM - __traceback_info__: ([], 'my-obj-path')
1/6/2025 10:06:56 AM Module plone.folder.ordered, line 229, in __getitem__
1/6/2025 10:06:56 AMKeyError: 'my-obj-path'
I created in Management Interface a python script to find all broken brains:
catalog = context.portal_catalog
brains = catalog('my-obj-path')
broken = []
for brain in brains:
try:
obj = brain.getObject()
except Exception:
broken.append(brain.getPath())
print(broken)
print("Count: ")
print(len(broken))
return printed
Then, the solution was to go to Catalog and press Update catalog. After 2 minutes, the problem was solved.
Category: Programare