{"record":{"id":"9d3ec0eabf3fd8e5","repo":"nopSolutions/nopCommerce","slug":"no-vendor-attribute-found-with-the-specified-id","errorCode":null,"errorMessage":"No vendor attribute found with the specified id","messagePattern":"No vendor attribute found with the specified id","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Presentation/Nop.Web/Areas/Admin/Controllers/VendorAttributeController.cs","lineNumber":220,"sourceCode":"        await _customerActivityService.InsertActivityAsync(\"DeleteVendorAttribute\",\n            string.Format(await _localizationService.GetResourceAsync(\"ActivityLog.DeleteVendorAttribute\"), vendorAttribute.Id), vendorAttribute);\n\n        _notificationService.SuccessNotification(await _localizationService.GetResourceAsync(\"Admin.Vendors.VendorAttributes.Deleted\"));\n\n        return RedirectToAction(\"List\");\n    }\n\n    #endregion\n\n    #region Vendor attribute values\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Configuration.MANAGE_SETTINGS)]\n    public virtual async Task<IActionResult> ValueList(VendorAttributeValueSearchModel searchModel)\n    {\n        //try to get a vendor attribute with the specified id\n        var vendorAttribute = await _vendorAttributeService.GetAttributeByIdAsync(searchModel.VendorAttributeId)\n            ?? throw new ArgumentException(\"No vendor attribute found with the specified id\");\n\n        //prepare model\n        var model = await _vendorAttributeModelFactory.PrepareVendorAttributeValueListModelAsync(searchModel, vendorAttribute);\n\n        return Json(model);\n    }\n\n    [CheckPermission(StandardPermission.Configuration.MANAGE_SETTINGS)]\n    public virtual async Task<IActionResult> ValueCreatePopup(int vendorAttributeId)\n    {\n        //try to get a vendor attribute with the specified id\n        var vendorAttribute = await _vendorAttributeService.GetAttributeByIdAsync(vendorAttributeId);\n        if (vendorAttribute == null)\n            return RedirectToAction(\"List\");\n\n        //prepare model\n        var model = await _vendorAttributeModelFactory.PrepareVendorAttributeValueModelAsync(new VendorAttributeValueModel(), vendorAttribute, null);\n","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Areas/Admin/Controllers/VendorAttributeController.cs#L202-L238","documentation":"Thrown by VendorAttributeController.ValueList when IVendorAttributeService.GetAttributeByIdAsync(searchModel.VendorAttributeId) returns null. This AJAX grid endpoint (behind MANAGE_SETTINGS permission) lists the values/options for a given vendor attribute; a missing parent attribute yields ArgumentException before the value-list model is prepared.","triggerScenarios":"Loading the vendor-attribute-values sub-grid for a vendor attribute that was deleted between the parent page load and the sub-grid data request. Posting a VendorAttributeId that does not exist or was reassigned. Concurrent deletion from another session.","commonSituations":"An admin deletes a vendor attribute in one tab while another tab has its values panel open; reloading that panel triggers the request with the now-invalid id. An import/migration renumbers vendor attribute ids, breaking cached sub-grid references.","solutions":["Reload the vendor attributes page so the deleted attribute and its stale sub-grid reference are removed.","Confirm the attribute id is still valid before relying on the values grid.","For custom integrations, pre-check the attribute existence and return an empty list if missing.","Catch ArgumentException and return a localized empty-grid JSON."],"exampleFix":"// before\nvar vendorAttribute = await _vendorAttributeService.GetAttributeByIdAsync(searchModel.VendorAttributeId)\n    ?? throw new ArgumentException(\"No vendor attribute found with the specified id\");\n\n// after\nvar vendorAttribute = await _vendorAttributeService.GetAttributeByIdAsync(searchModel.VendorAttributeId);\nif (vendorAttribute is null)\n    return Json(new { Data = Enumerable.Empty<object>(), Total = 0 });","handlingStrategy":"validation","validationCode":"var attr = await _vendorAttributeService.GetAttributeByIdAsync(searchModel.VendorAttributeId);\nif (attr is null)\n    return Json(new { Data = Enumerable.Empty<object>(), Total = 0 });","typeGuard":null,"tryCatchPattern":"try { await controller.ValueList(searchModel); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"No vendor attribute found\"))\n{ /* parent attribute deleted — return empty values grid */ }","preventionTips":["Clear vendor-attribute sub-grids when the parent attribute is deleted.","Reload the vendor attributes page to remove stale references.","Return empty results for AJAX grids referencing deleted parents."],"tags":["nopcommerce","admin-controller","not-found","vendor-attribute","argument-exception"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}