{"record":{"id":"e6a78dde140f9a99","repo":"nopSolutions/nopCommerce","slug":"no-video-found-with-the-specified-id","errorCode":null,"errorMessage":"No video found with the specified id","messagePattern":"No video found with the specified id","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Presentation/Nop.Web/Areas/Admin/Controllers/ProductController.cs","lineNumber":2370,"sourceCode":"    [CheckPermission(StandardPermission.Catalog.PRODUCTS_CREATE_EDIT_DELETE)]\n    public virtual async Task<IActionResult> ProductVideoUpdate([Validate] ProductVideoModel model)\n    {\n        //try to get a product picture with the specified id\n        var productVideo = await _productService.GetProductVideoByIdAsync(model.Id)\n            ?? throw new ArgumentException(\"No product video found with the specified id\");\n\n        //a vendor should have access only to his products\n        var currentVendor = await _workContext.GetCurrentVendorAsync();\n        if (currentVendor != null)\n        {\n            var product = await _productService.GetProductByIdAsync(productVideo.ProductId);\n            if (product != null && product.VendorId != currentVendor.Id)\n                return Content(\"This is not your product\");\n        }\n\n        //try to get a video with the specified id\n        var video = await _videoService.GetVideoByIdAsync(productVideo.VideoId)\n            ?? throw new ArgumentException(\"No video found with the specified id\");\n\n        var videoUrl = model.VideoUrl.TrimStart('~');\n\n        try\n        {\n            await PingVideoUrlAsync(videoUrl);\n        }\n        catch (Exception exc)\n        {\n            return Json(new\n            {\n                success = false,\n                error = $\"{await _localizationService.GetResourceAsync(\"Admin.Catalog.Products.Multimedia.Videos.Alert.VideoUpdate\")} {exc.Message}\",\n            });\n        }\n\n        video.VideoUrl = videoUrl;\n","sourceCodeStart":2352,"sourceCodeEnd":2388,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Areas/Admin/Controllers/ProductController.cs#L2352-L2388","documentation":"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.","triggerScenarios":"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.","commonSituations":"Maintenance scripts pruning the Video table without its mapping. A crashed ProductVideoDelete that removed the video but left the mapping. Storage cleanup.","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."],"exampleFix":"// before\nvar video = await _videoService.GetVideoByIdAsync(productVideo.VideoId)\n    ?? throw new ArgumentException(\"No video found with the specified id\");\n\n// after\nvar video = await _videoService.GetVideoByIdAsync(productVideo.VideoId);\nif (video == null)\n{\n    await _productService.DeleteProductVideoAsync(productVideo);\n    return Json(new { success = false, message = \"Underlying video missing; mapping removed.\" });\n}","handlingStrategy":"fallback","validationCode":"var video = await _videoService.GetVideoByIdAsync(productVideo.VideoId);\nif (video == null)\n{\n    await _productService.DeleteProductVideoAsync(productVideo); // reap orphan\n    return Json(new { success = false, message = \"Underlying video missing; mapping removed.\" });\n}","typeGuard":null,"tryCatchPattern":"try { /* update video */ }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"No video\"))\n    return Json(new { success = false, message = ex.Message });","preventionTips":["Run ProductVideo/Video consistency cleanup","Delete video and mapping transactionally","Add an FK/consistency check"],"tags":["nopcommerce","aspnet-mvc","data-integrity","orphaned-fk","video","not-found","argument-exception"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}