nopSolutions/nopCommerce · warning · NopException
Manufacturer not found
Error message
Manufacturer not found
What it means
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.
Source
Thrown at src/Presentation/Nop.Web/Areas/Admin/Factories/MenuModelFactory.cs:163
model.TopicId = topic.Id;
break;
}
case MenuItemType.Category:
{
var category = await _categoryService.GetCategoryByIdAsync(entityId);
if (category is null || category.Deleted)
throw new NopException("Category not found");
model.CategoryId = category.Id;
break;
}
case MenuItemType.Vendor:
{
var vendor = await _vendorService.GetVendorByIdAsync(entityId);
if (vendor is null || vendor.Deleted)
throw new NopException("Manufacturer not found");
model.VendorId = vendor.Id;
break;
}
case MenuItemType.Manufacturer:
{
var manufacturer = await _manufacturerService.GetManufacturerByIdAsync(entityId);
if (manufacturer is null || manufacturer.Deleted)
throw new NopException("Manufacturer not found");
model.ManufacturerId = manufacturer.Id;
break;
}
default:
break;
}
}View on GitHub (pinned to 64bdf2ff08)
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.
Example fix
// before (bug: wrong message in the Vendor case)
case MenuItemType.Vendor:
{
var vendor = await _vendorService.GetVendorByIdAsync(entityId);
if (vendor is null || vendor.Deleted)
throw new NopException("Manufacturer not found"); // <- misleading
model.VendorId = vendor.Id;
break;
}
// after (correct message)
case MenuItemType.Vendor:
{
var vendor = await _vendorService.GetVendorByIdAsync(entityId);
if (vendor is null || vendor.Deleted)
throw new NopException("Vendor not found");
model.VendorId = vendor.Id;
break;
} Defensive patterns
Strategy: validation
Validate before calling
// Validate vendor exists before initializing; also fix the misleading message upstream.
if (model.MenuItemTypeId == (int)MenuItemType.Vendor)
{
var vendor = await _vendorService.GetVendorByIdAsync(entityId);
if (vendor is null || vendor.Deleted)
{
_notificationService.WarningNotification($"Vendor {entityId} not found or deleted.");
return;
}
} Type guard
static bool VendorUsable(Vendor v) => v is not null && !v.Deleted;
Try / catch
try { /* vendor case */ }
catch (NopException ex) { _notificationService.WarningNotification(ex.Message); } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Vendor deleted while still on a menu; the copy-paste message itself misleads support staff into investigating manufacturers; data import mapping vendor ids incorrectly.
Related errors
- Topic not found
- Category not found
- Picture cannot be loaded
- Video cannot be loaded
- This is not your product
AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13).
Data as JSON: /api/errors/56ef6f83ebbd1bd8.
Report an issue: GitHub.