{"record":{"id":"ed5cc4aeceb748f0","repo":"nopSolutions/nopCommerce","slug":"no-affiliate-found-with-the-specified-id","errorCode":null,"errorMessage":"No affiliate found with the specified id","messagePattern":"No affiliate found with the specified id","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"warning","filePath":"src/Presentation/Nop.Web/Areas/Admin/Controllers/AffiliateController.cs","lineNumber":223,"sourceCode":"\n        await _affiliateService.DeleteAffiliateAsync(affiliate);\n\n        //activity log\n        await _customerActivityService.InsertActivityAsync(\"DeleteAffiliate\",\n            string.Format(await _localizationService.GetResourceAsync(\"ActivityLog.DeleteAffiliate\"), affiliate.Id), affiliate);\n\n        _notificationService.SuccessNotification(await _localizationService.GetResourceAsync(\"Admin.Affiliates.Deleted\"));\n\n        return RedirectToAction(\"List\");\n    }\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Promotions.AFFILIATES_VIEW)]\n    public virtual async Task<IActionResult> AffiliatedOrderListGrid(AffiliatedOrderSearchModel searchModel)\n    {\n        //try to get an affiliate with the specified id\n        var affiliate = await _affiliateService.GetAffiliateByIdAsync(searchModel.AffliateId)\n                        ?? throw new ArgumentException(\"No affiliate found with the specified id\");\n\n        //prepare model\n        var model = await _affiliateModelFactory.PrepareAffiliatedOrderListModelAsync(searchModel, affiliate);\n\n        return Json(model);\n    }\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Promotions.AFFILIATES_VIEW)]\n    public virtual async Task<IActionResult> AffiliatedCustomerList(AffiliatedCustomerSearchModel searchModel)\n    {\n        //try to get an affiliate with the specified id\n        var affiliate = await _affiliateService.GetAffiliateByIdAsync(searchModel.AffliateId)\n                        ?? throw new ArgumentException(\"No affiliate found with the specified id\");\n\n        //prepare model\n        var model = await _affiliateModelFactory.PrepareAffiliatedCustomerListModelAsync(searchModel, affiliate);\n","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Areas/Admin/Controllers/AffiliateController.cs#L205-L241","documentation":"Thrown by AffiliateController.AffiliatedOrderListGrid (permission: AFFILIATES_VIEW). The grid loads the parent affiliate by searchModel.AffliateId (note the typo 'AffliateId' in the model) and throws ArgumentException if not found. The affiliate was deleted or the id is invalid.","triggerScenarios":"POST AffiliatedOrderListGrid with an AffliateId that GetAffiliateByIdAsync cannot resolve — the affiliate record was removed while its orders tab was open, or the grid holds a stale id.","commonSituations":"Affiliate deleted in another tab while its affiliated-orders grid is still mounted; copy-paste of an affiliate id after a merge/purge; stale client-side state.","solutions":["Navigate back to the affiliate list and reopen an existing affiliate's order grid.","Return an empty grid instead of throwing when the parent affiliate is missing.","Confirm the request body actually carries a valid AffliateId field (mind the spelling)."],"exampleFix":"// before\nvar affiliate = await _affiliateService.GetAffiliateByIdAsync(searchModel.AffliateId)\n                ?? throw new ArgumentException(\"No affiliate found with the specified id\");\n\n// after\nvar affiliate = await _affiliateService.GetAffiliateByIdAsync(searchModel.AffliateId);\nif (affiliate == null)\n    return Json(new AffiliatedOrderListModel());\n","handlingStrategy":"validation","validationCode":"// Validate affiliate exists before building the affiliated-orders grid.\nvar affiliate = await _affiliateService.GetAffiliateByIdAsync(searchModel.AffliateId);\nif (affiliate == null) return Json(new AffiliatedOrderListModel());","typeGuard":"static bool AffiliateExists(Affiliate a) => a is not null;","tryCatchPattern":"try { /* AffiliatedOrderListGrid body */ }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"affiliate\"))\n{\n    return Json(new AffiliatedOrderListModel());\n}","preventionTips":["Reopen an existing affiliate before listing its orders.","Mind the 'AffliateId' spelling when binding the model.","Avoid deleting an affiliate while its grids are open."],"tags":["nopcommerce","admin","affiliate","not-found","stale-ui"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}