Object ID out of range for encoding

The Number IDs used in the KCM Repository database are not reusable, and therefore the ID value continually increases. As a result, IDs that are larger than 224 cause errors, because they exceed the limitation. In case of this event, further import most likely becomes impossible and the Repository log file will contain the following line:

FATAL ERROR] ..\..\shared\Base\ObjectRef.Cpp 42, repository::ObjectRef::numEncode(): Assertion 'myObjectId < 0x01000000' failed. Object id 16783462 out of range for encoding 

This line indicates that ID values have exceeded the limit of 224. The root cause for this issue may be repeated imports of large projects caused, for example, by daily routine updates.

To solve this problem, you need to clear the database.

  1. Export all relevant projects or verify that these projects have already been exported.

  2. Connect to an empty database.

    1. In case the repository is not the actual data source, clear the existing database.

    2. If the database needs to be preserved, create a new empty database.

    3. Use SetInstanceDatabase to connect (or reconnect) the instance to the database. Set Instance!DatabaseMode to New.

  3. Import all relevant projects.

Deleting projects does not solve this issue, because KCM Repository administers the last issued ID and it is not reset when the project is deleted. Also, repdump and repload still preserve the last issued ID administration and, therefore, cannot help to fix the issue.