nopSolutions/nopCommerce · error · ArgumentException
No record found
Error message
No record found
What it means
Thrown in the ItemClassification Update controller action when GetItemClassificationByIdAsync returns null for the model.Id provided. This ArgumentException means the item classification record being updated no longer exists in the database. The action is used to update the HSCode on an existing item classification record.
Source
Thrown at src/Plugins/Nop.Plugin.Tax.Avalara/Controllers/ItemClassificationController.cs:103
ProductId = item.ProductId,
ProductName = (await _productService.GetProductByIdAsync(item.ProductId))?.Name ?? "",
HSClassificationRequestId = item.HSClassificationRequestId,
CountryId = item.CountryId,
CountryName = (await _countryService.GetCountryByIdAsync(item.CountryId))?.Name ?? "*",
HSCode = item.HSCode,
UpdatedDate = await _dateTimeHelper.ConvertToUserTimeAsync(item.UpdatedOnUtc, DateTimeKind.Utc)
});
});
return Json(model);
}
[HttpPost]
[CheckPermission(StandardPermission.Configuration.MANAGE_TAX_SETTINGS)]
public async Task<IActionResult> Update(ItemClassificationModel model)
{
var item = await _itemClassificationService.GetItemClassificationByIdAsync(model.Id)
?? throw new ArgumentException("No record found");
item.HSCode = model.HSCode;
await _itemClassificationService.UpdateItemClassificationAsync(item);
return new NullJsonResult();
}
[HttpPost]
[CheckPermission(StandardPermission.Configuration.MANAGE_TAX_SETTINGS)]
public async Task<IActionResult> DeleteSelected(List<int> selectedIds)
{
if (!selectedIds?.Any() ?? true)
return NoContent();
var recordsToDelete = new List<int>();
foreach (var id in selectedIds)View on GitHub (pinned to 64bdf2ff08)
Solutions
- Refresh the item classification grid to verify the record still exists before editing
- Check the database: SELECT * FROM ItemClassification WHERE Id = <model.Id>
- If the record was deleted, create a new classification instead of updating a non-existent one
- Improve the UI to handle stale-record responses with a user-friendly message
Example fix
// before
var item = await _itemClassificationService.GetItemClassificationByIdAsync(model.Id)
?? throw new ArgumentException("No record found");
// after — return a proper HTTP response
var item = await _itemClassificationService.GetItemClassificationByIdAsync(model.Id);
if (item is null)
return NotFound($"Item classification {model.Id} no longer exists"); Defensive patterns
Strategy: validation
Validate before calling
// Verify item classification exists before attempting update
var item = await _itemClassificationService.GetItemClassificationByIdAsync(model.Id);
if (item is null)
return Json(new { error = "Record no longer exists — it may have been deleted by another user" }); Try / catch
// Controller action — catch ArgumentException and return user-friendly response
try
{
await _controller.Update(model);
}
catch (ArgumentException ex) when (ex.Message.Contains("No record found"))
{
Response.StatusCode = 404;
return Json(new { error = "Item classification no longer exists" });
} Prevention
- Refresh grid data before editing to detect records deleted by other users
- Return HTTP 404 instead of throwing ArgumentException for missing records
- Implement row versioning or concurrency tokens to handle concurrent edits
- Provide user-friendly error messages in the UI when records are stale or missing
When it happens
Trigger: An HTTP POST to the Update action with an ItemClassificationModel whose Id does not correspond to any ItemClassification record — typically from a grid edit form where the row was deleted between page load and save.
Common situations: The item classification was deleted via DeleteSelected or a bulk operation while another user had the edit form open; stale grid data; concurrent editing where one user deletes while another saves; the ID was modified in the request payload.
Related errors
- No tax category found with the specified id
- Tax provider is not configured
- Failed to delete customer
- Failed to get customer's certificates
- Failed to download certificate
AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13).
Data as JSON: /api/errors/590b5eca322515da.
Report an issue: GitHub.