{"record":{"id":"c8b350c7cfa21377","repo":"nopSolutions/nopCommerce","slug":"no-product-tag-found-with-the-specified-id","errorCode":null,"errorMessage":"No product tag found with the specified id","messagePattern":"No product tag found with the specified id","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Presentation/Nop.Web/Areas/Admin/Controllers/ProductController.cs","lineNumber":2687,"sourceCode":"    }\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Catalog.PRODUCT_TAGS_VIEW)]\n    public virtual async Task<IActionResult> ProductTags(ProductTagSearchModel searchModel)\n    {\n        //prepare model\n        var model = await _productModelFactory.PrepareProductTagListModelAsync(searchModel);\n\n        return Json(model);\n    }\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Catalog.PRODUCT_TAGS_CREATE_EDIT_DELETE)]\n    public virtual async Task<IActionResult> ProductTagDelete(int id)\n    {\n        //try to get a product tag with the specified id\n        var tag = await _productTagService.GetProductTagByIdAsync(id)\n            ?? throw new ArgumentException(\"No product tag found with the specified id\");\n\n        await _productTagService.DeleteProductTagAsync(tag);\n\n        _notificationService.SuccessNotification(await _localizationService.GetResourceAsync(\"Admin.Catalog.ProductTags.Deleted\"));\n\n        return RedirectToAction(\"ProductTags\");\n    }\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Catalog.PRODUCT_TAGS_CREATE_EDIT_DELETE)]\n    public virtual async Task<IActionResult> ProductTagsDelete(ICollection<int> selectedIds)\n    {\n        if (selectedIds == null || !selectedIds.Any())\n            return NoContent();\n\n        var tags = await _productTagService.GetProductTagsByIdsAsync(selectedIds.ToArray());\n        await _productTagService.DeleteProductTagsAsync(tags);\n","sourceCodeStart":2669,"sourceCodeEnd":2705,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Areas/Admin/Controllers/ProductController.cs#L2669-L2705","documentation":"Thrown by ProductTagDelete when _productTagService.GetProductTagByIdAsync(id) returns null. Product tags are global catalog entities (no vendor ownership check here). The endpoint deletes a tag by id from the product-tags grid.","triggerScenarios":"POST Admin/Product/ProductTagDelete?id=... for a tag already deleted (double delete), or a grid row stale after a prior delete or a ProductTagsDelete bulk action that already removed it.","commonSituations":"Double-click delete. Bulk ProductTagsDelete followed by an individual delete on the same id from a stale grid. Two admins managing tags concurrently.","solutions":["Make the delete idempotent: if the tag is gone, redirect to ProductTags without error.","Refresh the tags grid after any delete or bulk delete.","Disable the delete control until the AJAX response resolves.","Replace the throw with a null guard returning a notification/redirect."],"exampleFix":"// before\nvar tag = await _productTagService.GetProductTagByIdAsync(id)\n    ?? throw new ArgumentException(\"No product tag found with the specified id\");\nawait _productTagService.DeleteProductTagAsync(tag);\n\n// after\nvar tag = await _productTagService.GetProductTagByIdAsync(id);\nif (tag == null)\n{\n    _notificationService.ErrorNotification(await _localizationService.GetResourceAsync(\"Admin.Catalog.ProductTags.NotExist\"));\n    return RedirectToAction(\"ProductTags\");\n}\nawait _productTagService.DeleteProductTagAsync(tag);","handlingStrategy":"validation","validationCode":"var tag = await _productTagService.GetProductTagByIdAsync(id);\nif (tag == null)\n{\n    _notificationService.ErrorNotification(\"Tag no longer exists.\");\n    return RedirectToAction(\"ProductTags\");\n}","typeGuard":null,"tryCatchPattern":"try { /* delete tag */ }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"product tag\"))\n    return RedirectToAction(\"ProductTags\");","preventionTips":["Make tag deletes idempotent","Refresh tags grid after bulk delete","Avoid double-click deletes"],"tags":["nopcommerce","aspnet-mvc","admin","ajax","product-tags","not-found","idempotency","argument-exception"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}