nopSolutions/nopCommerce · error · ArgumentException

No return request action found with the specified id

Error message

No return request action found with the specified id

What it means

Thrown by ReturnRequestActionDelete (POST, MANAGE_SETTINGS) when GetReturnRequestActionByIdAsync(id) returns null. Mirror of error 491 for the action (not reason) side of return-request configuration; the entity is required to perform the delete. Includes nameof(id).

Source

Thrown at src/Presentation/Nop.Web/Areas/Admin/Controllers/ReturnRequestController.cs:458

                return RedirectToAction("ReturnRequestActionList");

            return RedirectToAction("ReturnRequestActionEdit", new { id = returnRequestAction.Id });
        }

        //prepare model
        model = await _returnRequestModelFactory.PrepareReturnRequestActionModelAsync(model, returnRequestAction, true);

        //if we got this far, something failed, redisplay form
        return View(model);
    }

    [HttpPost]
    [CheckPermission(StandardPermission.Configuration.MANAGE_SETTINGS)]
    public virtual async Task<IActionResult> ReturnRequestActionDelete(int id)
    {
        //try to get a return request action with the specified id
        var returnRequestAction = await _returnRequestService.GetReturnRequestActionByIdAsync(id)
                                  ?? throw new ArgumentException("No return request action found with the specified id", nameof(id));

        await _returnRequestService.DeleteReturnRequestActionAsync(returnRequestAction);

        _notificationService.SuccessNotification(await _localizationService.GetResourceAsync("Admin.Configuration.Settings.Order.ReturnRequestActions.Deleted"));

        return RedirectToAction("ReturnRequestActionList");
    }

    #endregion

    #endregion
}

View on GitHub (pinned to 64bdf2ff08)

Solutions

  1. Refresh the return-request-action list and target a current row.
  2. Prevent double-submit on the delete control.
  3. Make the action idempotent: missing entity = success.
  4. Validate id > 0 before posting.

Example fix

// before
var returnRequestAction = await _returnRequestService.GetReturnRequestActionByIdAsync(id)
                          ?? throw new ArgumentException("No return request action found with the specified id", nameof(id));

// after
var returnRequestAction = await _returnRequestService.GetReturnRequestActionByIdAsync(id);
if (returnRequestAction == null)
    return RedirectToAction("ReturnRequestActionList");
Defensive patterns

Strategy: validation

Validate before calling

if (id <= 0) return BadRequest();
var action = await _returnRequestService.GetReturnRequestActionByIdAsync(id);
if (action == null) return RedirectToAction("ReturnRequestActionList");

Type guard

// N/A

Try / catch

catch (ArgumentException ex) when (ex.ParamName == nameof(id))
{ return RedirectToAction("ReturnRequestActionList"); }

Prevention

When it happens

Trigger: Deleting a return-request action that was already removed; double-click on delete; tampered id; another admin reset return-request actions concurrently.

Common situations: Concurrent settings edits; restored DBs; fixtures; reorganized return-request actions in a parallel session.

Related errors


AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13). Data as JSON: /api/errors/c893b5c9f761f874. Report an issue: GitHub.