nopSolutions/nopCommerce · warning · ArgumentException
No address attribute found with the specified id
Error message
No address attribute found with the specified id
What it means
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.
Source
Thrown at src/Presentation/Nop.Web/Areas/Admin/Controllers/AddressAttributeController.cs:232
string.Format(await _localizationService.GetResourceAsync("ActivityLog.DeleteAddressAttribute"), addressAttribute.Id),
addressAttribute);
_notificationService.SuccessNotification(await _localizationService.GetResourceAsync("Admin.Address.AddressAttributes.Deleted"));
return RedirectToAction("List");
}
#endregion
#region Address attribute values
[HttpPost]
[CheckPermission(StandardPermission.Configuration.MANAGE_SETTINGS)]
public virtual async Task<IActionResult> ValueList(AddressAttributeValueSearchModel searchModel)
{
//try to get an address attribute with the specified id
var addressAttribute = await _addressAttributeService.GetAttributeByIdAsync(searchModel.AddressAttributeId)
?? throw new ArgumentException("No address attribute found with the specified id");
//prepare model
var model = await _addressAttributeModelFactory.PrepareAddressAttributeValueListModelAsync(searchModel, addressAttribute);
return Json(model);
}
[CheckPermission(StandardPermission.Configuration.MANAGE_SETTINGS)]
public virtual async Task<IActionResult> ValueCreatePopup(int addressAttributeId)
{
//try to get an address attribute with the specified id
var addressAttribute = await _addressAttributeService.GetAttributeByIdAsync(addressAttributeId);
if (addressAttribute == null)
return RedirectToAction("List");
//prepare model
var model = await _addressAttributeModelFactory
.PrepareAddressAttributeValueModelAsync(new AddressAttributeValueModel(), addressAttribute, null);View on GitHub (pinned to 64bdf2ff08)
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.
Example fix
// before
var addressAttribute = await _addressAttributeService.GetAttributeByIdAsync(searchModel.AddressAttributeId)
?? throw new ArgumentException("No address attribute found with the specified id");
// after
var addressAttribute = await _addressAttributeService.GetAttributeByIdAsync(searchModel.AddressAttributeId);
if (addressAttribute == null)
return Json(new AddressAttributeValueListModel());
Defensive patterns
Strategy: validation
Validate before calling
// Validate the parent attribute exists before requesting its value grid. var parent = await _addressAttributeService.GetAttributeByIdAsync(searchModel.AddressAttributeId); if (parent == null) return Json(new AddressAttributeValueListModel());
Type guard
static bool ParentAttributeExists(AddressAttribute a) => a is not null;
Try / catch
try { /* ValueList body */ }
catch (ArgumentException ex) when (ex.Message.Contains("address attribute"))
{
return Json(new AddressAttributeValueListModel());
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- No address attribute value found with the specified id
- No affiliate found with the specified id
- No category found with the specified id
- No checkout attribute found with the specified id
- No contact form attribute found with the specified id
AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13).
Data as JSON: /api/errors/e992d5cdf84edce9.
Report an issue: GitHub.