Cause of the Problem

The problem occurs because the custom property table (TST_ARTIFACT_CUSTOM_PROPERTY) has entries for test runs that no longer exist in the system. This can happen if you delete test runs from the database and the entries get left in this table.

Resolution

The solution is to run this SQL query that removes them:

DELETE FROM TST_ARTIFACT_CUSTOM_PROPERTY
WHERE ARTIFACT_TYPE_ID = 5
AND ARTIFACT_ID NOT IN (SELECT TEST_RUN_ID FROM TST_TEST_RUN)