{"record":{"id":"0213b56eeb66a172","repo":"nopSolutions/nopCommerce","slug":"no-slides-found-with-the-specified-picture-id","errorCode":null,"errorMessage":"No slides found with the specified picture id","messagePattern":"No slides found with the specified picture id","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Plugins/Nop.Plugin.Widgets.Swiper/Controllers/WidgetSwiperController.cs","lineNumber":240,"sourceCode":"        }\n\n        return new NullJsonResult();\n    }\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Configuration.MANAGE_WIDGETS)]\n    public virtual async Task<IActionResult> SlideEdit(SlidePictureModel model)\n    {\n        //load settings for a chosen store scope\n        var storeScope = await _storeContext.GetActiveStoreScopeConfigurationAsync();\n\n        var slides = await GetSlidesForStoreAsync(storeScope);\n        if (!slides?.Any() == true)\n            return Content(\"No slides\");\n\n        //try to get a picture with the specified id\n        var slide = slides.FirstOrDefault(s => s.PictureId == model.PictureId)\n            ?? throw new ArgumentException(\"No slides found with the specified picture id\");\n\n        slide.TitleText = model.TitleText;\n        slide.AltText = model.AltText;\n        slide.LinkUrl = model.LinkUrl;\n\n        var sliderSettings = await _settingService.LoadSettingAsync<SwiperSettings>(storeScope);\n        sliderSettings.Slides = JsonConvert.SerializeObject(slides);\n        await _settingService.SaveSettingOverridablePerStoreAsync(sliderSettings, x => x.Slides, true, storeScope);\n\n        return new NullJsonResult();\n    }\n\n    #endregion\n}","sourceCodeStart":222,"sourceCodeEnd":254,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Plugins/Nop.Plugin.Widgets.Swiper/Controllers/WidgetSwiperController.cs#L222-L254","documentation":"Thrown by the Swiper SlideEdit POST action (guarded by MANAGE_WIDGETS). After loading the store's slides, the controller looks for a slide whose PictureId equals model.PictureId; if none matches it throws ArgumentException. It indicates the edit form submitted a PictureId that is not present in the current store scope's slide list.","triggerScenarios":"POST SlideEdit with a model.PictureId that does not match any slide in GetSlidesForStoreAsync(storeScope). Happens when the slide was edited/deleted in another store scope, or the client sends a PictureId from a different/removed slide.","commonSituations":"Multi-store setups where slides differ per store; an admin has two browser tabs open against different store scopes; the slides JSON was changed out-of-band and a stale form was submitted.","solutions":["Reload the slide list in admin before editing so the form carries a current PictureId for the active store scope.","Verify the store scope selector matches the scope that owns the target slide.","Make the action defensive: return a NotFound/Json error instead of throwing when no slide matches (see exampleFix)."],"exampleFix":"// before\nvar slide = slides.FirstOrDefault(s => s.PictureId == model.PictureId)\n    ?? throw new ArgumentException(\"No slides found with the specified picture id\");\n\n// after\nvar slide = slides?.FirstOrDefault(s => s.PictureId == model.PictureId);\nif (slide == null)\n    return NotFound($\"No slide for picture {model.PictureId} in store {storeScope}\");\n","handlingStrategy":"validation","validationCode":"// Confirm the submitted PictureId belongs to the active store's slides before mutating.\nvar slides = await GetSlidesForStoreAsync(storeScope);\nif (slides?.Any(s => s.PictureId == model.PictureId) != true)\n    return NotFound(\"Slide not found for this store scope.\");","typeGuard":"static bool SlideMatchesStoreScope(IEnumerable<Slide> slides, int pictureId)\n    => slides?.Any(s => s.PictureId == pictureId) == true;","tryCatchPattern":"try { /* SlideEdit body */ }\ncatch (ArgumentException ex) when (ex.Message == \"No slides found with the specified picture id\")\n{\n    return BadRequest($\"Slide for picture {model.PictureId} not found in store {storeScope}.\");\n}","preventionTips":["Reload the slide list before editing so the form posts a current PictureId.","Keep the store-scope selector consistent between list and edit views.","Avoid editing the same swiper config across multiple browser tabs."],"tags":["nopcommerce","widget","swiper","not-found","multi-store"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}