nopSolutions/nopCommerce · error · ArgumentException
No return request reason found with the specified id
Error message
No return request reason found with the specified id
What it means
Thrown by ReturnRequestReasonDelete (POST, MANAGE_SETTINGS) when GetReturnRequestReasonByIdAsync(id) returns null. The action then deletes the reason and redirects; without a loaded entity the delete cannot proceed. The exception includes nameof(id) as the parameter name.
Source
Thrown at src/Presentation/Nop.Web/Areas/Admin/Controllers/ReturnRequestController.cs:338
return RedirectToAction("ReturnRequestReasonList");
return RedirectToAction("ReturnRequestReasonEdit", new { id = returnRequestReason.Id });
}
//prepare model
model = await _returnRequestModelFactory.PrepareReturnRequestReasonModelAsync(model, returnRequestReason, true);
//if we got this far, something failed, redisplay form
return View(model);
}
[HttpPost]
[CheckPermission(StandardPermission.Configuration.MANAGE_SETTINGS)]
public virtual async Task<IActionResult> ReturnRequestReasonDelete(int id)
{
//try to get a return request reason with the specified id
var returnRequestReason = await _returnRequestService.GetReturnRequestReasonByIdAsync(id)
?? throw new ArgumentException("No return request reason found with the specified id", nameof(id));
await _returnRequestService.DeleteReturnRequestReasonAsync(returnRequestReason);
_notificationService.SuccessNotification(await _localizationService.GetResourceAsync("Admin.Configuration.Settings.Order.ReturnRequestReasons.Deleted"));
return RedirectToAction("ReturnRequestReasonList");
}
#endregion
#region Return request actions
[CheckPermission(StandardPermission.Configuration.MANAGE_SETTINGS)]
public virtual IActionResult ReturnRequestActionList()
{
//select an appropriate card
SaveSelectedCardName("ordersettings-return-request");
View on GitHub (pinned to 64bdf2ff08)
Solutions
- Refresh the return-request-reason list and delete a current row.
- Disable the delete button after first click to prevent double-submit.
- Make the delete idempotent: treat a missing reason as success.
- Validate id > 0 before posting.
Example fix
// before
var returnRequestReason = await _returnRequestService.GetReturnRequestReasonByIdAsync(id)
?? throw new ArgumentException("No return request reason found with the specified id", nameof(id));
// after
var returnRequestReason = await _returnRequestService.GetReturnRequestReasonByIdAsync(id);
if (returnRequestReason == null)
return RedirectToAction("ReturnRequestReasonList"); Defensive patterns
Strategy: validation
Validate before calling
if (id <= 0) return BadRequest();
var reason = await _returnRequestService.GetReturnRequestReasonByIdAsync(id);
if (reason == null) return RedirectToAction("ReturnRequestReasonList"); Type guard
// N/A
Try / catch
catch (ArgumentException ex) when (ex.ParamName == nameof(id))
{ return RedirectToAction("ReturnRequestReasonList"); } Prevention
- Make delete idempotent (missing = success).
- Disable the delete control after first click.
- Refresh the reasons list before deleting.
When it happens
Trigger: Posting a delete for an already-removed return-request reason; double-click; tampered id; reason removed by another admin or by a settings reset between requests.
Common situations: Concurrent settings edits; restored DBs; fixtures; another admin reorganized return-request reasons mid-session.
Related errors
- No return request action found with the specified id
- No product attribute combination found with the specified id
- No specification attribute option found with the specified i
- No tax category found with the specified id
- No vendor attribute value found with the specified id
AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13).
Data as JSON: /api/errors/79fa6855e544e50d.
Report an issue: GitHub.