Duplicate entry in portal_catalog - same path, different rids

I have the same object showing up twice in my portal_catalog. They have the same path, '/db11/webdev/projects' but two different rids. Nothing weird seems to be happening on the site as far as I can tell, but the catalog count is definitely off by 1.

Looking at the workings of portal_catalog, I see that portal_catalog._catalog maintains three btrees: paths, uids, data. The names are a bit odd as the acquisition path is actually what is used as the uid, and these are really mappings of rid -> uid, uid -> rid, and rid -> metadata.

Deleting the extra rid doesn't help, and even doing a full a clear and rebuild causes the same uid to have two different rids and metadata entries. I thought maybe somehow the same object was being found twice when traversing the site for indexing, so in the debugger I tried to traverse the site and check if its called twice

>>> parents = []
>>> def recurse(obj):
...   for id, item in obj.objectItems():
...     if '/'.join(item.getPhysicalPath()) == '/db11/webdev/projects':
...       parents.append(obj)
>>> recurse(site)
>>> parents
[<PloneSite at /db11/webdev>]

It only comes across this object once, so I don't know why it's indexed twice. I know this is only an approximation of what ZopeFindAndApply is doing but it looks close enough? I've got this site in a dev environment so I can play around here, but I'm not sure what else I can do to debug the cause.

I was able to get it to correctly clear and rebuild by turning off the env var CATALOG_OPTIMIZATION_DISABLED. No idea what caused the duplicate originally though.