{"record":{"id":"745f447ce2a67852","repo":"nopSolutions/nopCommerce","slug":"no-vendor-found-with-the-specified-id","errorCode":null,"errorMessage":"No vendor found with the specified id","messagePattern":"No vendor found with the specified id","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Presentation/Nop.Web/Areas/Admin/Controllers/VendorController.cs","lineNumber":500,"sourceCode":"        await _customerActivityService.InsertActivityAsync(\"DeleteVendor\",\n            string.Format(await _localizationService.GetResourceAsync(\"ActivityLog.DeleteVendor\"), vendor.Id), vendor);\n\n        _notificationService.SuccessNotification(await _localizationService.GetResourceAsync(\"Admin.Vendors.Deleted\"));\n\n        return RedirectToAction(\"List\");\n    }\n\n    #endregion\n\n    #region Vendor notes\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Customers.VENDORS_VIEW)]\n    public virtual async Task<IActionResult> VendorNotesSelect(VendorNoteSearchModel searchModel)\n    {\n        //try to get a vendor with the specified id\n        var vendor = await _vendorService.GetVendorByIdAsync(searchModel.VendorId)\n            ?? throw new ArgumentException(\"No vendor found with the specified id\");\n\n        //prepare model\n        var model = await _vendorModelFactory.PrepareVendorNoteListModelAsync(searchModel, vendor);\n\n        return Json(model);\n    }\n\n    [CheckPermission(StandardPermission.Customers.VENDORS_CREATE_EDIT_DELETE)]\n    public virtual async Task<IActionResult> VendorNoteAdd(int vendorId, string message)\n    {\n        if (string.IsNullOrEmpty(message))\n            return ErrorJson(await _localizationService.GetResourceAsync(\"Admin.Vendors.VendorNotes.Fields.Note.Validation\"));\n\n        //try to get a vendor with the specified id\n        var vendor = await _vendorService.GetVendorByIdAsync(vendorId);\n        if (vendor == null)\n            return ErrorJson(\"Vendor cannot be loaded\");\n","sourceCodeStart":482,"sourceCodeEnd":518,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Areas/Admin/Controllers/VendorController.cs#L482-L518","documentation":"Thrown by VendorController.VendorNotesSelect when IVendorService.GetVendorByIdAsync(searchModel.VendorId) returns null. This AJAX endpoint (behind VENDORS_VIEW permission) loads the notes sub-grid for a vendor; a missing vendor record yields ArgumentException before the note-list model is prepared.","triggerScenarios":"Loading the vendor-notes sub-grid for a vendor that was deleted between the vendor-edit page load and the notes data request. Posting a VendorId that does not exist. Concurrent vendor deletion in another session while the notes panel is open.","commonSituations":"An admin deletes a vendor in one tab while another tab still shows the vendor-edit page with its notes panel; reloading notes triggers the request with the now-invalid id. A bulk vendor-deactivation/deletion job removed the record.","solutions":["Reload the vendor list and re-open the vendor; if it is gone, the notes request is expected to fail.","Confirm the vendor was not deleted by checking the vendor grid or activity log.","For programmatic callers, pre-validate the vendor id and return an empty notes list if missing.","Catch ArgumentException and return a localized empty-grid JSON."],"exampleFix":"// before\nvar vendor = await _vendorService.GetVendorByIdAsync(searchModel.VendorId)\n    ?? throw new ArgumentException(\"No vendor found with the specified id\");\n\n// after\nvar vendor = await _vendorService.GetVendorByIdAsync(searchModel.VendorId);\nif (vendor is null)\n    return Json(new { Data = Enumerable.Empty<object>(), Total = 0 });","handlingStrategy":"validation","validationCode":"var vendor = await _vendorService.GetVendorByIdAsync(searchModel.VendorId);\nif (vendor is null)\n    return Json(new { Data = Enumerable.Empty<object>(), Total = 0 });","typeGuard":null,"tryCatchPattern":"try { await controller.VendorNotesSelect(searchModel); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"No vendor found\"))\n{ /* vendor deleted — return empty notes grid */ }","preventionTips":["Invalidate the vendor-notes sub-grid when the parent vendor is deleted.","Reload the vendor edit page to confirm the vendor still exists.","Return empty results rather than throwing for deleted vendors in AJAX grids."],"tags":["nopcommerce","admin-controller","not-found","vendor","vendor-notes","argument-exception"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}