nopSolutions/nopCommerce · error · ArgumentException
No video found with the specified id
Error message
No video found with the specified id
What it means
Thrown later in ProductVideoUpdate when _videoService.GetVideoByIdAsync(productVideo.VideoId) returns null. The ProductVideo mapping exists but its Video record is missing (orphaned FK). The code then proceeds to ping and update the video URL.
Source
Thrown at src/Presentation/Nop.Web/Areas/Admin/Controllers/ProductController.cs:2370
[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
{
await PingVideoUrlAsync(videoUrl);
}
catch (Exception exc)
{
return Json(new
{
success = false,
error = $"{await _localizationService.GetResourceAsync("Admin.Catalog.Products.Multimedia.Videos.Alert.VideoUpdate")} {exc.Message}",
});
}
video.VideoUrl = videoUrl;
View on GitHub (pinned to 64bdf2ff08)
Solutions
- Run a consistency cleanup: remove ProductVideo mappings whose VideoId no longer resolves.
- Make video deletion transactional with mapping deletion.
- Replace the throw with a null guard that logs and removes the orphaned mapping.
- Add a foreign-key/periodic integrity check between ProductVideo and Video.
Example fix
// before
var video = await _videoService.GetVideoByIdAsync(productVideo.VideoId)
?? throw new ArgumentException("No video found with the specified id");
// after
var video = await _videoService.GetVideoByIdAsync(productVideo.VideoId);
if (video == null)
{
await _productService.DeleteProductVideoAsync(productVideo);
return Json(new { success = false, message = "Underlying video missing; mapping removed." });
} Defensive patterns
Strategy: fallback
Validate before calling
var video = await _videoService.GetVideoByIdAsync(productVideo.VideoId);
if (video == null)
{
await _productService.DeleteProductVideoAsync(productVideo); // reap orphan
return Json(new { success = false, message = "Underlying video missing; mapping removed." });
} Try / catch
try { /* update video */ }
catch (ArgumentException ex) when (ex.Message.Contains("No video"))
return Json(new { success = false, message = ex.Message }); Prevention
- Run ProductVideo/Video consistency cleanup
- Delete video and mapping transactionally
- Add an FK/consistency check
When it happens
Trigger: ProductVideo row present while the referenced Video was deleted out-of-band (direct DB delete, partial transaction). The mapping survived but its target did not.
Common situations: Maintenance scripts pruning the Video table without its mapping. A crashed ProductVideoDelete that removed the video but left the mapping. Storage cleanup.
Related errors
- No picture found with the specified id
- No product video found with the specified id
- No associated product found with the specified id
- No product picture found with the specified id
- No product tag found with the specified id
AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13).
Data as JSON: /api/errors/e6a78dde140f9a99.
Report an issue: GitHub.