Rebuild the entity field maps After deleting some fields and paragraph types, I have stale values in the entity field map - these cause notice-level errors in the /admin/reports/fields page, and seem to occasionally trigger weird exceptions. 

I've tracked the stale data to entity.definitions.bundle_field_map entries in the {key_value} table. Unfortunately, neither running cron nor synchronizing the configuration nor clearing the cache seems to update this.

I've deleted the entries from the table entirely, but they just stay gone. Is there a way to completely rebuild the map from the active configuration?



Update: For future reference, this problem (and similar entity schema corruption) was a likely consequence of mucking around with unalterable internals (type, machine name, etc) of existing fields. Never do that; this system is complex, easy to break, and basically impossible to get back into a consistent state without reinstalling or reverting to backup.

Any changes to the storage of a field should be done by creating a new field, copying data, and deleting the old field. Even if you want to retain the existing machine name, it is easier to follow these steps twice (using a temporary field) than to try to touch the internals.

(Also, some aspects of the schema seem to be updated by cron, so before reusing a deleted field's machine name, make sure to run cron to let it perform cleanup.)
Update: It seems this data is never rebuilt in full, but is only updated by a field definition listener.

One possible solution is to remove all fields and bundles from the site (by deleting the configuration from the sync folder and importing), then re-creating them (by reverting the deletions and importing again). This will obviously delete any content that may have been created.