{"record":{"id":"e992d5cdf84edce9","repo":"nopSolutions/nopCommerce","slug":"no-address-attribute-found-with-the-specified-id","errorCode":null,"errorMessage":"No address attribute found with the specified id","messagePattern":"No address attribute found with the specified id","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"warning","filePath":"src/Presentation/Nop.Web/Areas/Admin/Controllers/AddressAttributeController.cs","lineNumber":232,"sourceCode":"            string.Format(await _localizationService.GetResourceAsync(\"ActivityLog.DeleteAddressAttribute\"), addressAttribute.Id),\n            addressAttribute);\n\n        _notificationService.SuccessNotification(await _localizationService.GetResourceAsync(\"Admin.Address.AddressAttributes.Deleted\"));\n\n        return RedirectToAction(\"List\");\n    }\n\n    #endregion\n\n    #region Address attribute values\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Configuration.MANAGE_SETTINGS)]\n    public virtual async Task<IActionResult> ValueList(AddressAttributeValueSearchModel searchModel)\n    {\n        //try to get an address attribute with the specified id\n        var addressAttribute = await _addressAttributeService.GetAttributeByIdAsync(searchModel.AddressAttributeId)\n            ?? throw new ArgumentException(\"No address attribute found with the specified id\");\n\n        //prepare model\n        var model = await _addressAttributeModelFactory.PrepareAddressAttributeValueListModelAsync(searchModel, addressAttribute);\n\n        return Json(model);\n    }\n\n    [CheckPermission(StandardPermission.Configuration.MANAGE_SETTINGS)]\n    public virtual async Task<IActionResult> ValueCreatePopup(int addressAttributeId)\n    {\n        //try to get an address attribute with the specified id\n        var addressAttribute = await _addressAttributeService.GetAttributeByIdAsync(addressAttributeId);\n        if (addressAttribute == null)\n            return RedirectToAction(\"List\");\n\n        //prepare model\n        var model = await _addressAttributeModelFactory\n            .PrepareAddressAttributeValueModelAsync(new AddressAttributeValueModel(), addressAttribute, null);","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Areas/Admin/Controllers/AddressAttributeController.cs#L214-L250","documentation":"Thrown by AddressAttributeController.ValueList (permission: MANAGE_SETTINGS). The grid datasource for address attribute values first loads the parent attribute by searchModel.AddressAttributeId; if none exists it throws ArgumentException. The parent address attribute was deleted or the id is invalid.","triggerScenarios":"POST ValueList with an AddressAttributeId that GetAttributeByIdAsync cannot find — typically the parent attribute was removed while its child-value grid tab was still open in the browser.","commonSituations":"Admin opens attribute A's value grid, deletes attribute A from another tab, the original grid issues an AJAX list call referencing the now-gone parent.","solutions":["Close and reopen the address attributes list so the UI only references existing parent ids.","Make ValueList return an empty result instead of throwing when the parent is missing.","Audit client-side code that may be caching a stale AddressAttributeId."],"exampleFix":"// before\nvar addressAttribute = await _addressAttributeService.GetAttributeByIdAsync(searchModel.AddressAttributeId)\n    ?? throw new ArgumentException(\"No address attribute found with the specified id\");\n\n// after\nvar addressAttribute = await _addressAttributeService.GetAttributeByIdAsync(searchModel.AddressAttributeId);\nif (addressAttribute == null)\n    return Json(new AddressAttributeValueListModel());\n","handlingStrategy":"validation","validationCode":"// Validate the parent attribute exists before requesting its value grid.\nvar parent = await _addressAttributeService.GetAttributeByIdAsync(searchModel.AddressAttributeId);\nif (parent == null) return Json(new AddressAttributeValueListModel());","typeGuard":"static bool ParentAttributeExists(AddressAttribute a) => a is not null;","tryCatchPattern":"try { /* ValueList body */ }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"address attribute\"))\n{\n    return Json(new AddressAttributeValueListModel());\n}","preventionTips":["Reload the address attributes list before opening a value grid.","Return an empty grid instead of throwing for a missing parent.","Avoid deleting a parent attribute while its value tab is open."],"tags":["nopcommerce","admin","address-attribute","not-found","stale-ui"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}