nopSolutions/nopCommerce · error · ArgumentException

No product video found with the specified id

Error message

No product video found with the specified id

What it means

Thrown by ProductVideoUpdate when _productService.GetProductVideoByIdAsync(model.Id) returns null. model.Id is the ProductVideo mapping row being edited (DisplayOrder/URL), posted from the videos grid inline editor.

Source

Thrown at src/Presentation/Nop.Web/Areas/Admin/Controllers/ProductController.cs:2357

        //a vendor should have access only to his products
        var currentVendor = await _workContext.GetCurrentVendorAsync();
        if (currentVendor != null && product.VendorId != currentVendor.Id)
            return Content("This is not your product");

        //prepare model
        var model = await _productModelFactory.PrepareProductVideoListModelAsync(searchModel, product);

        return Json(model);
    }

    [HttpPost]
    [CheckPermission(StandardPermission.Catalog.PRODUCTS_CREATE_EDIT_DELETE)]
    public virtual async Task<IActionResult> ProductVideoUpdate([Validate] ProductVideoModel model)
    {
        //try to get a product picture with the specified id
        var productVideo = await _productService.GetProductVideoByIdAsync(model.Id)
            ?? throw new ArgumentException("No product video found with the specified id");

        //a vendor should have access only to his products
        var currentVendor = await _workContext.GetCurrentVendorAsync();
        if (currentVendor != null)
        {
            var product = await _productService.GetProductByIdAsync(productVideo.ProductId);
            if (product != null && product.VendorId != currentVendor.Id)
                return Content("This is not your product");
        }

        //try to get a video with the specified id
        var video = await _videoService.GetVideoByIdAsync(productVideo.VideoId)
            ?? throw new ArgumentException("No video found with the specified id");

        var videoUrl = model.VideoUrl.TrimStart('~');

        try
        {

View on GitHub (pinned to 64bdf2ff08)

Solutions

  1. Refresh the videos grid before inline editing.
  2. Replace the throw with a null guard returning Json(new { success = false }).
  3. Avoid simultaneous video edits on the same product.
  4. Batch video operations rather than interleaving with manual edits.

Example fix

// before
var productVideo = await _productService.GetProductVideoByIdAsync(model.Id)
    ?? throw new ArgumentException("No product video found with the specified id");

// after
var productVideo = await _productService.GetProductVideoByIdAsync(model.Id);
if (productVideo == null)
    return Json(new { success = false, message = "Video mapping no longer exists." });
Defensive patterns

Strategy: validation

Validate before calling

var productVideo = await _productService.GetProductVideoByIdAsync(model.Id);
if (productVideo == null)
    return Json(new { success = false, message = "Video mapping no longer exists." });

Try / catch

try { /* update */ }
catch (ArgumentException ex) when (ex.Message.Contains("product video"))
    return Json(new { success = false, message = ex.Message });

Prevention

When it happens

Trigger: POST Admin/Product/ProductVideoUpdate with model.Id of a ProductVideo row removed (video deleted, mapping cleared) between grid render and the update post.

Common situations: Concurrent video management on the same product; one deletes while the other edits. Grid not refreshed after a video deletion.

Related errors


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