{"record":{"id":"c3b2f4e0cd411817","repo":"nopSolutions/nopCommerce","slug":"no-product-attribute-value-found-with-the-specifie","errorCode":null,"errorMessage":"No product attribute value found with the specified id","messagePattern":"No product attribute value found with the specified id","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Presentation/Nop.Web/Areas/Admin/Controllers/ProductController.cs","lineNumber":3658,"sourceCode":"            ViewBag.RefreshPage = true;\n\n            return View(model);\n        }\n\n        //prepare model\n        model = await _productModelFactory.PrepareProductAttributeValueModelAsync(model, productAttributeMapping, productAttributeValue, true);\n\n        //if we got this far, something failed, redisplay form\n        return View(model);\n    }\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Catalog.PRODUCTS_CREATE_EDIT_DELETE)]\n    public virtual async Task<IActionResult> ProductAttributeValueDelete(int id)\n    {\n        //try to get a product attribute value with the specified id\n        var productAttributeValue = await _productAttributeService.GetProductAttributeValueByIdAsync(id)\n            ?? throw new ArgumentException(\"No product attribute value found with the specified id\");\n\n        //try to get a product attribute mapping with the specified id\n        var productAttributeMapping = await _productAttributeService.GetProductAttributeMappingByIdAsync(productAttributeValue.ProductAttributeMappingId)\n            ?? throw new ArgumentException(\"No product attribute mapping found with the specified id\");\n\n        //try to get a product with the specified id\n        var product = await _productService.GetProductByIdAsync(productAttributeMapping.ProductId)\n            ?? throw new ArgumentException(\"No product found with the specified id\");\n\n        //a vendor should have access only to his products\n        var currentVendor = await _workContext.GetCurrentVendorAsync();\n        if (currentVendor != null && product.VendorId != currentVendor.Id)\n            return Content(\"This is not your product\");\n\n        //check if existed combinations contains the specified attribute value\n        var existedCombinations = await _productAttributeService.GetAllProductAttributeCombinationsAsync(product.Id);\n        if (existedCombinations?.Any() == true)\n        {","sourceCodeStart":3640,"sourceCodeEnd":3676,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Areas/Admin/Controllers/ProductController.cs#L3640-L3676","documentation":"Thrown by ProductAttributeValueDelete (POST) when _productAttributeService.GetProductAttributeValueByIdAsync(id) returns null. The action expects a valid ProductAttributeValue id from the request body; a missing/stale/deleted row produces this ArgumentException, which propagates as a 500 to the admin UI. It is the first of a three-stage cascade (value -> mapping -> product) used to authorize and scope the delete operation.","triggerScenarios":"POST to admin ProductAttributeValueDelete with an `id` that is 0, negative, references an already-deleted ProductAttributeValue, or is forged by a tampered grid row. Also triggered when two admins race: one deletes the value while the other's grid still lists it.","commonSituations":"Concurrent edits in the admin product-attribute grid; stale browser tabs after a value was removed; automated/scripted calls replaying an old id; corrupted bookmarks pointing at deleted values.","solutions":["Refresh the product attribute values list and re-issue the delete against a current id.","Verify the id is non-zero and corresponds to an existing ProductAttributeValue before posting.","Check whether another admin or a bulk operation already removed that attribute value.","If reproducing via API/tooling, confirm you are calling the action with the correct `{ id }` form field name."],"exampleFix":"// before\nvar productAttributeValue = await _productAttributeService.GetProductAttributeValueByIdAsync(id)\n    ?? throw new ArgumentException(\"No product attribute value found with the specified id\");\n\n// after (graceful 404 instead of 500)\nvar productAttributeValue = await _productAttributeService.GetProductAttributeValueByIdAsync(id);\nif (productAttributeValue == null)\n    return NotFound($\"No product attribute value found with id {id}\");","handlingStrategy":"validation","validationCode":"var value = await _productAttributeService.GetProductAttributeValueByIdAsync(id);\nif (value == null)\n    return NotFound();\n// proceed with delete","typeGuard":"// N/A - id is a primitive int; guard with existence check, not a type guard.","tryCatchPattern":"try { /* delete */ }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"No product attribute value\"))\n{ return NotFound(ex.Message); }","preventionTips":["Fetch and confirm the id from a freshly rendered grid, not a cached page.","Pre-check existence with a lightweight lookup before posting the delete.","Disable the delete control after first click to avoid duplicate requests."],"tags":["nopcommerce","admin-controller","not-found","argument-exception","product-attribute"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}