Error: "update or delete on table "app_template" violates foreign key constraint "<Template Name>" on table "catalog_item"" when attempting to delete a stuck Catalog Item
search cancel

Error: "update or delete on table "app_template" violates foreign key constraint "<Template Name>" on table "catalog_item"" when attempting to delete a stuck Catalog Item

book

Article ID: 372652

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

  • There is an error when you try to remove this Template/ISO from Catalogs in VMware Cloud Director (VCD) UI

Details : [ #########-####-####-####-############ ] Internal Server Error
 - Could not execute JDBC batch update; SQL [/* Method: unknown */ /* delete com.vmware.vcloud.common.model.contenthub.AppTemplateModel */ delete from app_template where id=?]; constraint [<Template Name>]; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
 - Batch entry 0 /* Method: unknown */ /* Method: unknown */ /* delete com.vmware.vcloud.common.model.contenthub.AppTemplateModel */ delete from app_template where id='#########-####-####-####-############'::uuid was aborted: ERROR: update or delete on table "app_template" violates foreign key constraint "<Template Name>" on table "catalog_item"
  Detail: Key (id)=(#########-####-####-####-############) is still referenced from table "catalog_item".  Call getNextException to see other errors in the batch.

  • You might notice the following error during NSX V2T cleanup 

vcdOperations]:[migrateCatalogItems]:3768 [WARNING] [hostedsol]| Media Items - vappTemplate-#########-####-####-####-############,vappTemplate-#########-####-####-####-############,vappTemplate-#########-####-####-####-############,vappTemplate-#########-####-####-####-############,vappTemplate-#########-####-####-####-############,vappTemplate-#########-####-####-####-############,vappTemplate-#########-####-####-####-############,vappTemplate-#########-####-####-####-############ with no catalog linked to them exists. Migration of catalog might fail. Please remove stale items manually.

  • Catalog/Media Uploaded to VCD may show up on a "not ready" state

Environment

VMware Cloud Director 10.x

Cause

This issue may occur when uploading a vApp Template to a Catalog and cancelling the task midway.

Resolution

If the Catalog Item cannot be deleted from the VCD UI or API please contact Broadcom Support and note this Article ID (372652) in the problem description.
For more information, see Creating and managing Broadcom support cases.