Upgraded plone to 5.2 instance error IntIdMissingError: z3c.relationfield.relation.RelationValue

Hello! Please help solve the problem.
I am trying to upgrade from version 5.1.6 to 5.2.7
I get the error in the next step:
/portal_setup/manage_upgrades
Upgrade Step Group
-> Run to52beta1 upgrade profile. (5201 → 5202)
-> Run to52rc1 upgrade profile. (5201 → 5202)

Traceback (innermost last):
  Module ZPublisher.WSGIPublisher, line 155, in transaction_pubevents
  Module ZPublisher.WSGIPublisher, line 337, in publish_module
  Module ZPublisher.WSGIPublisher, line 255, in publish
  Module ZPublisher.mapply, line 85, in mapply
  Module ZPublisher.WSGIPublisher, line 61, in call_object
  Module Products.GenericSetup.tool, line 1088, in manage_doUpgrades
  Module Products.GenericSetup.upgrade, line 168, in doStep
  Module plone.app.upgrade.v52.betas, line 110, in to52beta1
  Module plone.app.upgrade.v52.betas, line 72, in remove_interface_indexes_from_relations_catalog
  Module zc.relation.catalog, line 564, in unindex
  Module z3c.relationfield.index, line 42, in dump
  Module five.intid.intid, line 41, in getId
  Module zope.intid, line 108, in getId
IntIdMissingError: <z3c.relationfield.relation.RelationValue object at 0xad63b22c oid 0x4b396 in <Connection at b4992dec>>

I’m getting this too on a current upgrade project. It’s probably the next thing I have to figure out so I’ll post again if I make progress.

Do you know if it is hitting this for you on a Relation field in a custom or extended content type vs an included type? For me it is not a default type it is a custom field on a type provided by an add-on.

For myself, I used the following solution, which is not correct, but works.
In the file
plone.app.upgrade/plone/app/upgrade/v52/betas.py
I commented out the line 72:

for rel in relations:
#catalog.unindex (rel) <-----------------------------
try:
catalog.index (rel)
except IntIdMissingError:
logger.warn ('Broken relation removed.')

Result log:
........
........
2019-11-17 19:08:37,903 WARNING [plone.app.upgrade:76][waitress] Broken relation removed.
2019-11-17 19:08:37,904 WARNING [plone.app.upgrade:76][waitress] Broken relation removed.
2019-11-17 19:08:37,905 WARNING [plone.app.upgrade:76][waitress] Broken relation removed.
2019-11-17 19:08:37,906 WARNING [plone.app.upgrade:76][waitress] Broken relation removed.
2019-11-17 19:08:37,907 WARNING [plone.app.upgrade:76][waitress] Broken relation removed.
2019-11-17 19:08:37,908 WARNING [plone.app.upgrade:76][waitress] Broken relation removed.

So far, I have not found any losses and problems.

There was an error on early upgrade code to Plone 5.2, I think it was to 5.2RC1 that created errors when upgrading the relation catalog:

But this was fixed on latest version of 5.2 so you should not have any problems now.

You should upgrade your site to 5.2 directly, without going through the beta or RC versions.

I am using the latest stable version of Plone 5.2.0 (5207) which includes plone.app.upgrade 2.0.27 with corrections.
It is not possible to immediately upgrade from 5.1 to 5.2. using the fixes, all update steps are automatically performed.
This is a code error or my catalog is not standard.

Then I don't know what's going on there. I had the relations error when I tested the migration in several of our sites, and it was gone after the said changes.

Plone Foundation Code of Conduct