{"record":{"id":"8a29cc1306cade93","repo":"nopSolutions/nopCommerce","slug":"mname-manufacturer-could-not-be-loaded","errorCode":null,"errorMessage":"\"{mName}\" manufacturer could not be loaded","messagePattern":"\"(.+?)\" manufacturer could not be loaded","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/Libraries/Nop.Services/Installation/InstallSampleData.Products.cs","lineNumber":145,"sourceCode":"                    throw new Exception($\"\\\"{tName}\\\" template could not be loaded\"));\n        }\n\n        async Task<int> getTaxCategoryId(string taxCategoryName)\n        {\n            return await getAndSaveId(taxCategories, taxCategoryName, async tcName => await GetFirstEntityIdAsync<TaxCategory>(tc => tc.Name == tcName) ??\n                throw new Exception($\"\\\"{tcName}\\\" tax category could not be loaded\"));\n        }\n\n        async Task<int> getCategoryId(string categoryName)\n        {\n            return await getAndSaveId(categories, categoryName, async cName => await GetFirstEntityIdAsync<Category>(c => c.Name == cName) ??\n                throw new Exception($\"\\\"{cName}\\\" category could not be loaded\"));\n        }\n\n        async Task<int> getManufacturerId(string manufacturerName)\n        {\n            return await getAndSaveId(manufacturers, manufacturerName, async mName => await GetFirstEntityIdAsync<Manufacturer>(m => m.Name == mName) ??\n                throw new Exception($\"\\\"{mName}\\\" manufacturer could not be loaded\"));\n        }\n\n        async Task<int> getProductAttributeId(string productAttributeName)\n        {\n            return await getAndSaveId(productAttributes, productAttributeName, async paName => await GetFirstEntityIdAsync<ProductAttribute>(pa => pa.Name == paName) ??\n                throw new Exception($\"\\\"{paName}\\\" product attribute could not be loaded\"));\n        }\n\n        async Task<int> getProductAvailabilityRangeId(string productAvailabilityRangeName)\n        {\n            return await getAndSaveId(productAvailabilityRanges, productAvailabilityRangeName, async parName => await GetFirstEntityIdAsync<ProductAvailabilityRange>(par => par.Name == parName) ??\n                throw new Exception($\"\\\"{parName}\\\" product availability range could not be loaded\"));\n        }\n\n        async Task<int> getDeliveryDateId(string deliveryDateName)\n        {\n            return await getAndSaveId(deliveryDates, deliveryDateName, async ddName => await GetFirstEntityIdAsync<DeliveryDate>(dd => dd.Name == ddName) ??\n                throw new Exception($\"\\\"{ddName}\\\" delivery date could not be loaded\"));","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Libraries/Nop.Services/Installation/InstallSampleData.Products.cs#L127-L163","documentation":"Thrown by getManufacturerId during sample-product installation. It looks up a Manufacturer by name; a null result means the referenced manufacturer does not exist, so sample products cannot be linked to it. As with sibling lookups, it indicates manufacturer seeding was skipped or the sample data references an unknown name.","triggerScenarios":"Installing sample products referencing a Manufacturer name not present in the DB; running product sample install before manufacturer seeding; a name mismatch in the sample data.","commonSituations":"Partial install missing manufacturer seeding; reordering of install steps; custom sample-data file with wrong manufacturer names.","solutions":["Run the manufacturer-seeding install step before sample product install.","Verify referenced Manufacturer names exist before installing sample products.","Correct manufacturer-name typos in the sample-data source.","Reinstall from a clean database."],"exampleFix":"// before\nasync mName => await GetFirstEntityIdAsync<Manufacturer>(m => m.Name == mName)\n    ?? throw new Exception($\"\\\"{mName}\\\" manufacturer could not be loaded\")\n\n// after\nvar id = await GetFirstEntityIdAsync<Manufacturer>(m => m.Name == manufacturerName);\nif (id == 0)\n    throw new InvalidOperationException($\"Manufacturer '{manufacturerName}' not found. Seed manufacturers first.\");","handlingStrategy":"validation","validationCode":"// Verify referenced manufacturers exist before sample install\nvar needed = new[] { \"Acme\", \"Globex\" };\nvar missing = needed.Except(await Table<Manufacturer>().Select(m => m.Name).ToListAsync());\nif (missing.Any())\n    throw new InvalidOperationException($\"Missing manufacturers: {string.Join(\", \", missing)}\");","typeGuard":"static async Task<bool> ManufacturerExistsAsync(IRepository<Manufacturer> repo, string name)\n    => await repo.Table.AnyAsync(m => m.Name == name);","tryCatchPattern":"try { await getManufacturerId(name); }\ncatch (Exception ex) when (ex.Message.Contains(\"manufacturer could not be loaded\"))\n{ /* log missing name + available manufacturers; abort sample install */ }","preventionTips":["Seed manufacturers before installing sample products.","Keep manufacturer names in sample data aligned with seeded names.","Reinstall from a clean DB."],"tags":["installation","sample-data","manufacturer","seeding","nopcommerce"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}