{"record":{"id":"02f76aeb64064897","repo":"nopSolutions/nopCommerce","slug":"no-customer-found-with-the-specified-id-02f76a","errorCode":null,"errorMessage":"No customer found with the specified id","messagePattern":"No customer found with the specified id","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Presentation/Nop.Web/Areas/Admin/Controllers/ShoppingCartController.cs","lineNumber":64,"sourceCode":"    }\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Orders.CURRENT_CARTS_MANAGE)]\n    public virtual async Task<IActionResult> CurrentCarts(ShoppingCartSearchModel searchModel)\n    {\n        //prepare model\n        var model = await _shoppingCartModelFactory.PrepareShoppingCartListModelAsync(searchModel);\n\n        return Json(model);\n    }\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Orders.CURRENT_CARTS_MANAGE)]\n    public virtual async Task<IActionResult> GetCartDetails(ShoppingCartItemSearchModel searchModel)\n    {\n        //try to get a customer with the specified id\n        var customer = await _customerService.GetCustomerByIdAsync(searchModel.CustomerId)\n                       ?? throw new ArgumentException(\"No customer found with the specified id\");\n\n        //prepare model\n        var model = await _shoppingCartModelFactory.PrepareShoppingCartItemListModelAsync(searchModel, customer);\n\n        return Json(model);\n    }\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Orders.CURRENT_CARTS_MANAGE)]\n    public virtual async Task<IActionResult> DeleteItem(int id)\n    {\n        await _shoppingCartService.DeleteShoppingCartItemAsync(id);\n\n        return new NullJsonResult();\n    }\n\n    #endregion\n}","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Areas/Admin/Controllers/ShoppingCartController.cs#L46-L82","documentation":"Thrown by ShoppingCartController.GetCartDetails when ICustomerService.GetCustomerByIdAsync(searchModel.CustomerId) returns null. The action is an AJAX endpoint behind the CURRENT_CARTS_MANAGE permission that expands a customer's current cart; it expects a valid customer id and aborts with ArgumentException if the lookup fails. Because no try-catch wraps the call, the exception surfaces as an HTTP 500 to the grid's data request.","triggerScenarios":"Expanding a 'current cart' detail row in the admin shopping-cart grid for a customer record that was subsequently deleted, anonymized, or had its id changed. Also reproducible by posting a CustomerId of 0 or a non-existent value from a stale list page, or when a guest customer's record was purged by a scheduled cleanup task.","commonSituations":"An admin opens the current-carts list, walks away, and the guest-customer record is purged by a background job before they expand the row. A customer was merged or deleted in another admin tab. A plugin or import script removed customer rows between page load and the AJAX detail call.","solutions":["Refresh the current-carts grid so the customer list reflects the latest data, then expand the cart detail again.","If the customer was intentionally deleted, no action is needed — the orphaned cart will be cleaned up by nopCommerce's maintenance routines.","For programmatic callers, guard with a null check on GetCustomerByIdAsync before calling GetCartDetails and return an empty or no-op result.","Check the customer activity/GDPR deletion log to confirm whether the customer was removed by design."],"exampleFix":"// before\nvar customer = await _customerService.GetCustomerByIdAsync(searchModel.CustomerId)\n               ?? throw new ArgumentException(\"No customer found with the specified id\");\n\n// after\nvar customer = await _customerService.GetCustomerByIdAsync(searchModel.CustomerId);\nif (customer is null)\n    return ErrorJson(\"Customer no longer exists.\");","handlingStrategy":"validation","validationCode":"var customer = await _customerService.GetCustomerByIdAsync(searchModel.CustomerId);\nif (customer is null)\n    return Json(new { Data = Enumerable.Empty<object>(), Total = 0 });","typeGuard":null,"tryCatchPattern":"try { var result = await shoppingCartController.GetCartDetails(searchModel); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"No customer found\"))\n{ /* customer purged — return empty cart detail */ }","preventionTips":["Reload the current-carts grid periodically; guest customers are purged by background jobs.","Handle the AJAX detail expansion failure gracefully in the UI with a 'customer no longer available' message.","For integrations, check customer existence before requesting cart details."],"tags":["nopcommerce","admin-controller","not-found","shopping-cart","customer","argument-exception"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}