When issuing `bosh clean-up --all` to clean up unused objects on BOSH director, it fails with error as below example.
...
Task 4334 | 07:02:11 | Deleting releases: routing/0.319.0 (00:00:01)
Task 4334 | 07:02:11 | Error: PG::ForeignKeyViolation: ERROR: update or delete on table "templates" violates foreign key constraint "instances_templates_template_id_fkey" on table "instances_templates"
DETAIL: Key (id)=(345) is still referenced from table "instances_templates".
...
The problem is caused by unhealthy instances which are managed by the BOSH director.