When a table extending sys_metadata is deleted from the UI, if there were records in that table, then the corresponding sys_metadata records are not removed.
Steps to Reproduce
Create a new table that extends sys_metadata.
Navigate to that table and create a new record in it.
Note the sys_id of the the record you just created.
Delete the table (without deleting the record in it).
Navigate to sys_metadata and search by sys_id using the id from step 3.
Note that the record has not been removed.
This problem was fixed since Istanbul Patch 5. If the affected instance can not be upgraded yet, please follow the steps below:
Identify the corrupt rows due to orphan records in sys_metadata by editing the following URL to point to the affected instance and specify the name of the deleted table:
Click the information icon to confirm that the records are not valid.
A blue info message stating Record not found should display.
Select affected records in the list and delete them. If the delete fails, reach out to ServiceNow support to remove the orphan records from the database.
Exceptions thrown during Source Control operations may leave the repository in a bad state causing issues with next operations. Once above cleanup is complete, apply the workaround from KB0622002 to prevent further thrown exceptions.
Related Problem: PRB684316