{"record":{"id":"251dd3914708da7a","repo":"nopSolutions/nopCommerce","slug":"no-setting-found-with-the-specified-id","errorCode":null,"errorMessage":"No setting found with the specified id","messagePattern":"No setting found with the specified id","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Presentation/Nop.Web/Areas/Admin/Controllers/SettingController.cs","lineNumber":1915,"sourceCode":"    [CheckPermission(StandardPermission.Configuration.MANAGE_SETTINGS)]\n    public virtual async Task<IActionResult> AllSettings(SettingSearchModel searchModel)\n    {\n        //prepare model\n        var model = await _settingModelFactory.PrepareSettingListModelAsync(searchModel);\n\n        return Json(model);\n    }\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Configuration.MANAGE_SETTINGS)]\n    public virtual async Task<IActionResult> SettingUpdate(SettingModel model)\n    {\n        if (!ModelState.IsValid)\n            return ErrorJson(ModelState.SerializeErrors());\n\n        //try to get a setting with the specified id\n        var setting = await _settingService.GetSettingByIdAsync(model.Id)\n            ?? throw new ArgumentException(\"No setting found with the specified id\");\n\n        if (!setting.Name.Equals(model.Name, StringComparison.InvariantCultureIgnoreCase))\n        {\n            //setting name has been changed\n            await _settingService.DeleteSettingAsync(setting);\n        }\n\n        await _settingService.SetSettingAsync(model.Name, model.Value, setting.StoreId);\n\n        //activity log\n        await _customerActivityService.InsertActivityAsync(\"EditSettings\", await _localizationService.GetResourceAsync(\"ActivityLog.EditSettings\"), setting);\n\n        return new NullJsonResult();\n    }\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Configuration.MANAGE_SETTINGS)]\n    public virtual async Task<IActionResult> SettingAdd(SettingModel model)","sourceCodeStart":1897,"sourceCodeEnd":1933,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Areas/Admin/Controllers/SettingController.cs#L1897-L1933","documentation":"Thrown by SettingUpdate (POST, MANAGE_SETTINGS) when GetSettingByIdAsync(model.Id) returns null. The action edits a single setting row; if the id does not match an existing Setting (deleted between grid render and save, or tampered), it throws ArgumentException. Note the action then may delete-and-recreate the setting if the name changed.","triggerScenarios":"Inline-editing a setting row whose underlying Setting was removed; tampered model.Id; settings cleared by a reset/migration while the all-settings grid was open; another admin deleted the row.","commonSituations":"Concurrent settings edits; restored DBs; plugin uninstalls that removed their settings rows; fixtures with stale ids.","solutions":["Refresh the all-settings grid before editing a row.","Validate model.Id resolves to a setting before submitting the edit.","Make the update tolerant: treat missing as 'recreate from model' or return ErrorJson.","Avoid deleting settings while inline edits are pending."],"exampleFix":"// before\nvar setting = await _settingService.GetSettingByIdAsync(model.Id)\n    ?? throw new ArgumentException(\"No setting found with the specified id\");\n\n// after\nvar setting = await _settingService.GetSettingByIdAsync(model.Id);\nif (setting == null)\n    return ErrorJson(\"Setting no longer exists; refresh the grid.\");","handlingStrategy":"validation","validationCode":"if (model.Id <= 0) return ErrorJson(\"Invalid setting id.\");\nvar setting = await _settingService.GetSettingByIdAsync(model.Id);\nif (setting == null) return ErrorJson(\"Setting no longer exists.\");","typeGuard":"// N/A","tryCatchPattern":"catch (ArgumentException ex) when (ex.Message.Contains(\"No setting found\"))\n{ return ErrorJson(ex.Message); }","preventionTips":["Refresh the all-settings grid before editing.","Validate setting existence before saving inline edits.","Avoid deleting settings while inline edits are pending."],"tags":["nopcommerce","admin-controller","not-found","setting","inline-edit"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}