Contract subpanel not working in Accounts module (invalid SQL query)

After an upgrade to 8.6.2 the Contracts subpanel does not work anymore in the accounts module.

The follwing is logged in the suitecrm.log file:

Error running count query for Account List: Query Failed: ( SELECT count(*) c FROM aos_contract
s LEFT JOIN aos_contracts_cstm ON aos_contracts.id = aos_contracts_cstm.id_c join aos_contracts_cstm on aos_contracts.id = aos_contracts_cstm.id where ( aos_contracts_cstm.
actief_c=1 and aos_contracts.contract_account_id = ‘a01dea52-89ed-bcc7-4a3d-5e847215c29c’) AND aos_contracts.deleted=0 ): MySQL error 1066: Not unique table/alias: ‘aos_contra
cts_cstm’

Note that the query is invalid as it joins the aos_contracts_cstm twice. I tried all repair options but that did not resolve the issue.

If you can reproduce this on the live demo then I would say it is definitely a bug that you should report on Github.

If not, try Admin / Repair relationships, and examine any custom code or custom relationships you might have created.