{"record":{"id":"eb5b0c10371884e9","repo":"nopSolutions/nopCommerce","slug":"no-category-found-with-the-specified-id","errorCode":null,"errorMessage":"No category found with the specified id","messagePattern":"No category found with the specified id","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"warning","filePath":"src/Presentation/Nop.Web/Areas/Admin/Controllers/CategoryController.cs","lineNumber":464,"sourceCode":"        }\n        catch (Exception exc)\n        {\n            await _notificationService.ErrorNotificationAsync(exc);\n            return RedirectToAction(\"List\");\n        }\n    }\n\n    #endregion\n\n    #region Products\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Catalog.CATEGORIES_VIEW)]\n    public virtual async Task<IActionResult> ProductList(CategoryProductSearchModel searchModel)\n    {\n        //try to get a category with the specified id\n        var category = await _categoryService.GetCategoryByIdAsync(searchModel.CategoryId)\n            ?? throw new ArgumentException(\"No category found with the specified id\");\n\n        //prepare model\n        var model = await _categoryModelFactory.PrepareCategoryProductListModelAsync(searchModel, category);\n\n        return Json(model);\n    }\n\n    [CheckPermission(StandardPermission.Catalog.CATEGORIES_CREATE_EDIT_DELETE)]\n    public virtual async Task<IActionResult> ProductUpdate(CategoryProductModel model)\n    {\n        //try to get a product category with the specified id\n        var productCategory = await _categoryService.GetProductCategoryByIdAsync(model.Id)\n            ?? throw new ArgumentException(\"No product category mapping found with the specified id\");\n\n        //fill entity from product\n        productCategory = model.ToEntity(productCategory);\n        await _categoryService.UpdateProductCategoryAsync(productCategory);\n","sourceCodeStart":446,"sourceCodeEnd":482,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Areas/Admin/Controllers/CategoryController.cs#L446-L482","documentation":"Thrown by CategoryController.ProductList (permission: CATEGORIES_VIEW). The product-grid datasource loads the parent category by searchModel.CategoryId and throws ArgumentException if absent. The category was deleted or the id is invalid for the current scope.","triggerScenarios":"POST ProductList with a CategoryId that GetCategoryByIdAsync cannot find — parent category removed while its product tab was open, or a stale/tampered id.","commonSituations":"Concurrent catalog edits; category deleted in another tab; UI caching an old CategoryId after navigation.","solutions":["Reopen the category from the list so the product grid references a current CategoryId.","Return an empty product list instead of throwing when the parent category is missing.","Audit client-side code that may retain a stale CategoryId across navigation."],"exampleFix":"// before\nvar category = await _categoryService.GetCategoryByIdAsync(searchModel.CategoryId)\n    ?? throw new ArgumentException(\"No category found with the specified id\");\n\n// after\nvar category = await _categoryService.GetCategoryByIdAsync(searchModel.CategoryId);\nif (category == null)\n    return Json(new CategoryProductListModel());\n","handlingStrategy":"validation","validationCode":"// Validate category exists before listing its products.\nvar category = await _categoryService.GetCategoryByIdAsync(searchModel.CategoryId);\nif (category == null) return Json(new CategoryProductListModel());","typeGuard":"static bool CategoryExists(Category c) => c is not null;","tryCatchPattern":"try { /* ProductList body */ }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"category\"))\n{\n    return Json(new CategoryProductListModel());\n}","preventionTips":["Reopen the category from the list before viewing products.","Return an empty grid for a missing parent instead of throwing.","Avoid stale CategoryId in client-side state."],"tags":["nopcommerce","admin","category","not-found","stale-ui"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}