{"record":{"id":"590b5eca322515da","repo":"nopSolutions/nopCommerce","slug":"no-record-found-590b5e","errorCode":null,"errorMessage":"No record found","messagePattern":"No record found","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Plugins/Nop.Plugin.Tax.Avalara/Controllers/ItemClassificationController.cs","lineNumber":103,"sourceCode":"                ProductId = item.ProductId,\n                ProductName = (await _productService.GetProductByIdAsync(item.ProductId))?.Name ?? \"\",\n                HSClassificationRequestId = item.HSClassificationRequestId,\n                CountryId = item.CountryId,\n                CountryName = (await _countryService.GetCountryByIdAsync(item.CountryId))?.Name ?? \"*\",\n                HSCode = item.HSCode,\n                UpdatedDate = await _dateTimeHelper.ConvertToUserTimeAsync(item.UpdatedOnUtc, DateTimeKind.Utc)\n            });\n        });\n\n        return Json(model);\n    }\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Configuration.MANAGE_TAX_SETTINGS)]\n    public async Task<IActionResult> Update(ItemClassificationModel model)\n    {\n        var item = await _itemClassificationService.GetItemClassificationByIdAsync(model.Id)\n            ?? throw new ArgumentException(\"No record found\");\n\n        item.HSCode = model.HSCode;\n\n        await _itemClassificationService.UpdateItemClassificationAsync(item);\n\n        return new NullJsonResult();\n    }\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Configuration.MANAGE_TAX_SETTINGS)]\n    public async Task<IActionResult> DeleteSelected(List<int> selectedIds)\n    {\n        if (!selectedIds?.Any() ?? true)\n            return NoContent();\n\n        var recordsToDelete = new List<int>();\n\n        foreach (var id in selectedIds)","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Plugins/Nop.Plugin.Tax.Avalara/Controllers/ItemClassificationController.cs#L85-L121","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nvar item = await _itemClassificationService.GetItemClassificationByIdAsync(model.Id)\n    ?? throw new ArgumentException(\"No record found\");\n\n// after — return a proper HTTP response\nvar item = await _itemClassificationService.GetItemClassificationByIdAsync(model.Id);\nif (item is null)\n    return NotFound($\"Item classification {model.Id} no longer exists\");","handlingStrategy":"validation","validationCode":"// Verify item classification exists before attempting update\nvar item = await _itemClassificationService.GetItemClassificationByIdAsync(model.Id);\nif (item is null)\n    return Json(new { error = \"Record no longer exists — it may have been deleted by another user\" });","typeGuard":null,"tryCatchPattern":"// Controller action — catch ArgumentException and return user-friendly response\ntry\n{\n    await _controller.Update(model);\n}\ncatch (ArgumentException ex) when (ex.Message.Contains(\"No record found\"))\n{\n    Response.StatusCode = 404;\n    return Json(new { error = \"Item classification no longer exists\" });\n}","preventionTips":["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"],"tags":["avalara","item-classification","crud","controller","argument-exception","nopcommerce"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}