{"record":{"id":"56ef6f83ebbd1bd8","repo":"nopSolutions/nopCommerce","slug":"manufacturer-not-found","errorCode":null,"errorMessage":"Manufacturer not found","messagePattern":"Manufacturer not found","errorType":"exception","errorClass":"NopException","httpStatus":null,"severity":"warning","filePath":"src/Presentation/Nop.Web/Areas/Admin/Factories/MenuModelFactory.cs","lineNumber":163,"sourceCode":"                    model.TopicId = topic.Id;\n                    break;\n                }\n                case MenuItemType.Category:\n                {\n                    var category = await _categoryService.GetCategoryByIdAsync(entityId);\n\n                    if (category is null || category.Deleted)\n                        throw new NopException(\"Category not found\");\n\n                    model.CategoryId = category.Id;\n                    break;\n                }\n                case MenuItemType.Vendor:\n                {\n                    var vendor = await _vendorService.GetVendorByIdAsync(entityId);\n\n                    if (vendor is null || vendor.Deleted)\n                        throw new NopException(\"Manufacturer not found\");\n\n                    model.VendorId = vendor.Id;\n                    break;\n                }\n                case MenuItemType.Manufacturer:\n                {\n                    var manufacturer = await _manufacturerService.GetManufacturerByIdAsync(entityId);\n\n                    if (manufacturer is null || manufacturer.Deleted)\n                        throw new NopException(\"Manufacturer not found\");\n\n                    model.ManufacturerId = manufacturer.Id;\n                    break;\n                }\n                default:\n                    break;\n            }\n        }","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Areas/Admin/Factories/MenuModelFactory.cs#L145-L181","documentation":"Thrown inside the Vendor case of InitMenuItemModelEntityIdAsync when the loaded vendor is null or soft-deleted. IMPORTANT BUG: the message text is \"Manufacturer not found\" but the code is resolving a Vendor via _vendorService.GetVendorByIdAsync — this is a copy-paste defect; the message does not match the entity type. Functionally it means the Vendor referenced by the menu item cannot be loaded. The exception is caught at line 182 and shown as a warning, but the misleading wording will confuse operators diagnosing the problem.","triggerScenarios":"A menu item of type Vendor references a VendorId whose Vendor record is null (never existed / hard-orphaned) or has Deleted = true. Because the message says 'Manufacturer', an admin reading the warning will look in the wrong entity area.","commonSituations":"Vendor deleted while still on a menu; the copy-paste message itself misleads support staff into investigating manufacturers; data import mapping vendor ids incorrectly.","solutions":["Fix the message text to \"Vendor not found\" (source defect at line 163) so the warning is diagnostic.","Reopen the menu item and select a valid, non-deleted vendor.","Restore the deleted vendor or remove the dangling menu item.","Add a referential-integrity check to vendor deletion that reassigns/removes dependent menu items."],"exampleFix":"// before (bug: wrong message in the Vendor case)\ncase MenuItemType.Vendor:\n{\n    var vendor = await _vendorService.GetVendorByIdAsync(entityId);\n    if (vendor is null || vendor.Deleted)\n        throw new NopException(\"Manufacturer not found\"); // <- misleading\n    model.VendorId = vendor.Id;\n    break;\n}\n// after (correct message)\ncase MenuItemType.Vendor:\n{\n    var vendor = await _vendorService.GetVendorByIdAsync(entityId);\n    if (vendor is null || vendor.Deleted)\n        throw new NopException(\"Vendor not found\");\n    model.VendorId = vendor.Id;\n    break;\n}","handlingStrategy":"validation","validationCode":"// Validate vendor exists before initializing; also fix the misleading message upstream.\nif (model.MenuItemTypeId == (int)MenuItemType.Vendor)\n{\n    var vendor = await _vendorService.GetVendorByIdAsync(entityId);\n    if (vendor is null || vendor.Deleted)\n    {\n        _notificationService.WarningNotification($\"Vendor {entityId} not found or deleted.\");\n        return;\n    }\n}","typeGuard":"static bool VendorUsable(Vendor v) => v is not null && !v.Deleted;","tryCatchPattern":"try { /* vendor case */ }\ncatch (NopException ex) { _notificationService.WarningNotification(ex.Message); }","preventionTips":["Patch the message at line 163 from 'Manufacturer not found' to 'Vendor not found' so diagnostics are correct.","Add dependent-menu cleanup to vendor deletion.","Validate vendor id at menu-item save time, not only render time."],"tags":["nopcommerce","admin","menu","vendor","copy-paste-bug","misleading-message","data-integrity"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}