Warning

This document hasn't been checked for compatibility with current versions of Plone. Use at your own risk.

Fixing broken content objects

by Mikko Ohtamaa last modified Jan 22, 2009 02:20 PM
Sometimes Plone content objects end up to a broken state. Managing them through the normal web user interface doesn't not work anymore and gives errors. This how to shows how to fix them through Zope Managemenet Interface and catalog rebuild.

Introduction

Sometimes Plone content objects end up to a broken state. Managing them through the normal web user interface doesn't not work anymore and gives errors. There are can be various reasons for this

  • Writing to the ZODB database has failed
  • Site was improperly shutdown
  • Add on products have caused errors

Symptoms

Even though the content object appears in the navigation tree and search results, you will get error messages like:

We're sorry, but that page doesn't exist…

/mysite/myfolder/myobjectid could not be deleted.

One or more selected items is no longer available.

Also you can see errors like in the site error log (available in the site setup):

* <FSPythonScript at /twinapex/content_edit_impl used for /twinapex/products/portal_factory/Folder/folder.2009-01-21.6911038969>
  Line 13
* Module Products.LinguaPlone.I18NBaseObject, line 350, in processForm
* Module Products.Archetypes.BaseObject, line 664, in processForm
* Module Products.Archetypes.BaseObject, line 773, in _renameAfterCreation
* Module Products.Archetypes.BaseObject, line 216, in setId
* Module Products.ATContentTypes.lib.autosort, line 150, in manage_renameObject
* Module Products.CMFPlone.PloneTool, line 1156, in reindexOnReorder
* Module Products.ZCatalog.CatalogBrains, line 86, in getObject
* Module OFS.Traversable, line 301, in restrictedTraverse
* Module OFS.Traversable, line 269, in unrestrictedTraverse
  __traceback_info__: ([], 'my-broken-object-id')

AttributeError: my-broken-object-id

Prerequisities

You need to know how to enter and use Zope management interface (ZMI).

Cause

The usual cause for such errors is that portal_catalog (search index) is not in the synchronization with the actual content objects. This how to covers only such use case - they are primarily identified by AttributeError log entries described above.

Plone stores the object information in two places: the actual primary copy of the object and a cataloged information. The cataloged information is fast look-up data which is used to generate navigation and search listings.

Step 1: Check if the object exist in ZMI

Zope management interface bypasses portal_catalog use when accessing the content objects and will display you the raw object data if available.

  • Enter ZMI.
  • Your content object appears in Plone site instance listings by their ids as they appear in the site. Don't let the vast amount of utility entries confuse you.
  • If you cannot find the object in ZMI the catalog information is outdated - you can go to step 2
  • If the object can be found and accessed via ZMI, delete it in ZMI
  • The changes made through ZMI are not automatically reflected to the catalog. You need to rebuild the catalog manually.

Step 2: Refresh Plone portal_catalog

This operation will update Plone navigation and search data to match the actual working content on the site. Note: if you have over hundreds of content objects this operation will be very time consuming.

  • Enter ZMI
  • Go to your Plone site instance root folder
  • In the main ZMI folder listing, choose portal_catalog utility (this does not appear on the left navigation tree)
  • Choose Advanced tab
  • Click Clear and Rebuild
  • Now stale navigation entries should have disappeared from Plone site

Contribute

Something wrong or out of date? Anybody can edit or create a new article in the knowledge base. Simply create an account on this site, log in, and click the Edit button to contribute.