nopSolutions/nopCommerce · error · ArgumentException

No product review found with the specified id

Error message

No product review found with the specified id

What it means

Thrown by ProductReviewReviewTypeMappingList (POST, PRODUCT_REVIEWS_VIEW) when GetProductReviewByIdAsync(searchModel.ProductReviewId) returns null. The sub-grid of review-type mappings cannot be built without the parent review, so the lookup failure aborts the model factory.

Source

Thrown at src/Presentation/Nop.Web/Areas/Admin/Controllers/ProductReviewController.cs:304

        await _productReviewService.DeleteProductReviewsAsync(productReviews);

        //activity log
        var activityLogFormat = await _localizationService.GetResourceAsync("ActivityLog.DeleteProductReview");
        await _customerActivityService.InsertActivitiesAsync("DeleteProductReview", productReviews, productReview => string.Format(activityLogFormat, productReview.Id));

        //update product totals
        foreach (var product in products)
            await _productReviewService.UpdateProductReviewTotalsAsync(product);

        return Json(new { Result = true });
    }

    [HttpPost]
    [CheckPermission(StandardPermission.Catalog.PRODUCT_REVIEWS_VIEW)]
    public virtual async Task<IActionResult> ProductReviewReviewTypeMappingList(ProductReviewReviewTypeMappingSearchModel searchModel)
    {
        var productReview = await _productReviewService.GetProductReviewByIdAsync(searchModel.ProductReviewId)
            ?? throw new ArgumentException("No product review found with the specified id");

        //prepare model
        var model = await _productReviewModelFactory.PrepareProductReviewReviewTypeMappingListModelAsync(searchModel, productReview);

        return Json(model);
    }

    #endregion
}

View on GitHub (pinned to 64bdf2ff08)

Solutions

  1. Reload the product-reviews list and open a current review before expanding its mappings.
  2. Return an empty payload when the review is missing rather than surfacing a 500.
  3. Avoid deleting reviews while their mapping sub-grids are loading.
  4. Validate ProductReviewId > 0 before issuing the request.

Example fix

// before
var productReview = await _productReviewService.GetProductReviewByIdAsync(searchModel.ProductReviewId)
    ?? throw new ArgumentException("No product review found with the specified id");

// after
var productReview = await _productReviewService.GetProductReviewByIdAsync(searchModel.ProductReviewId);
if (productReview == null)
    return Json(new { Data = Enumerable.Empty<object>(), Total = 0 });
Defensive patterns

Strategy: validation

Validate before calling

if (searchModel.ProductReviewId <= 0) return Json(empty);
var review = await _productReviewService.GetProductReviewByIdAsync(searchModel.ProductReviewId);
if (review == null) return Json(empty);

Type guard

// N/A

Try / catch

catch (ArgumentException ex) when (ex.Message.Contains("No product review"))
{ return Json(new { Data = Array.Empty<object>(), Total = 0 }); }

Prevention

When it happens

Trigger: The review-type-mapping sub-grid requests data for a ProductReviewId that was deleted (e.g. a moderated/disapproved review was purged); stale tab; tampered id; review removed between page load and sub-grid load.

Common situations: Bulk review moderation that deletes reviews while the detail view is open; restored DBs; concurrent admin moderation; URLs from cached pages.

Related errors


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