{"record":{"id":"79bc5355e6e22d12","repo":"nopSolutions/nopCommerce","slug":"no-contact-form-attribute-found-with-the-specified","errorCode":null,"errorMessage":"No contact form attribute found with the specified id","messagePattern":"No contact form attribute found with the specified id","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"warning","filePath":"src/Presentation/Nop.Web/Areas/Admin/Controllers/ContactFormAttributeController.cs","lineNumber":215,"sourceCode":"        //activity log\n        await _customerActivityService.InsertActivityAsync(\"DeleteContactFormAttribute\",\n            string.Format(await _localizationService.GetResourceAsync(\"ActivityLog.DeleteContactFormAttribute\"), contactFormAttribute.Id),\n            contactFormAttribute);\n\n        _notificationService.SuccessNotification(await _localizationService.GetResourceAsync(\"Admin.Common.ContactFormAttributes.Deleted\"));\n        return RedirectToAction(\"List\");\n    }\n\n    #endregion\n\n    #region Contact form attribute values\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Configuration.MANAGE_SETTINGS)]\n    public virtual async Task<IActionResult> ValueList(ContactFormAttributeValueSearchModel searchModel)\n    {\n        var contactFormAttribute = await _contactFormAttributeService.GetAttributeByIdAsync(searchModel.ContactFormAttributeId)\n            ?? throw new ArgumentException(\"No contact form attribute found with the specified id\");\n\n        //prepare model\n        var model = await _contactFormAttributeModelFactory.PrepareContactFormAttributeValueListModelAsync(searchModel, contactFormAttribute);\n\n        return Json(model);\n    }\n\n    [CheckPermission(StandardPermission.Configuration.MANAGE_SETTINGS)]\n    public virtual async Task<IActionResult> ValueCreatePopup(int contactFormAttributeId)\n    {\n        var contactFormAttribute = await _contactFormAttributeService.GetAttributeByIdAsync(contactFormAttributeId);\n        if (contactFormAttribute == null)\n            return RedirectToAction(\"List\");\n\n        //prepare model\n        var model = await _contactFormAttributeModelFactory\n            .PrepareContactFormAttributeValueModelAsync(new ContactFormAttributeValueModel(), contactFormAttribute, null);\n","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Areas/Admin/Controllers/ContactFormAttributeController.cs#L197-L233","documentation":"Thrown by ContactFormAttributeController.ValueList (permission: MANAGE_SETTINGS). The value-grid datasource loads the parent contact-form attribute by searchModel.ContactFormAttributeId and throws ArgumentException if missing. The parent attribute was deleted or the id is invalid.","triggerScenarios":"POST ValueList with a ContactFormAttributeId that GetAttributeByIdAsync cannot resolve — parent attribute removed while its values tab was open, or a stale/tampered id.","commonSituations":"Concurrent attribute management; deleting the contact-form attribute in one tab while its value grid is mounted in another; cached client-side state.","solutions":["Reopen the contact-form attributes list and select a current attribute before listing its values.","Return an empty value list instead of throwing when the parent attribute is missing.","Verify the grid posts a valid ContactFormAttributeId after navigation."],"exampleFix":"// before\nvar contactFormAttribute = await _contactFormAttributeService.GetAttributeByIdAsync(searchModel.ContactFormAttributeId)\n    ?? throw new ArgumentException(\"No contact form attribute found with the specified id\");\n\n// after\nvar contactFormAttribute = await _contactFormAttributeService.GetAttributeByIdAsync(searchModel.ContactFormAttributeId);\nif (contactFormAttribute == null)\n    return Json(new ContactFormAttributeValueListModel());\n","handlingStrategy":"validation","validationCode":"// Validate parent contact-form attribute before listing values.\nvar attr = await _contactFormAttributeService.GetAttributeByIdAsync(searchModel.ContactFormAttributeId);\nif (attr == null) return Json(new ContactFormAttributeValueListModel());","typeGuard":"static bool ContactFormAttributeExists(ContactFormAttribute a) => a is not null;","tryCatchPattern":"try { /* ValueList body */ }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"contact form attribute\"))\n{\n    return Json(new ContactFormAttributeValueListModel());\n}","preventionTips":["Reopen the contact-form attributes list before opening a value grid.","Return an empty grid for a missing parent.","Avoid deleting a parent attribute while its value tab is open."],"tags":["nopcommerce","admin","contact-form-attribute","not-found","stale-ui"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}