nopSolutions/nopCommerce · error · ArgumentException
Admin.PriceLists.Import.ProductsDontExist
Error message
Admin.PriceLists.Import.ProductsDontExist
What it means
Thrown during price-list XLSX import when product SKUs referenced by price-list items do not exist in the database. nopCommerce batches all referenced price-list-item SKUs into one SQL check (GetNotExistingProductsAsync) and aborts the import with an ArgumentException listing the missing SKUs.
Source
Thrown at src/Libraries/Nop.Services/ExportImport/ImportManager.cs:1693
//skip caption row
if (!priceListItemManager.IsCaption)
allPriceListItemSkus.Add(priceListItemManager.GetDefaultProperty("Sku").StringValue);
endRow++;
continue;
}
//counting the number of orders
countPriceListsInFile++;
endRow++;
}
//performance optimization, the check for the existence of the order items in one SQL request
var notExistingProductSkus = await _productService.GetNotExistingProductsAsync(allPriceListItemSkus.ToArray());
if (notExistingProductSkus.Any())
throw new ArgumentException(string.Format(await _localizationService.GetResourceAsync("Admin.PriceLists.Import.ProductsDontExist"), string.Join(", ", notExistingProductSkus)));
return (new ImportPriceListMetadata
{
EndRow = endRow,
Manager = manager,
Properties = defaultProperties,
CountPriceListsInFile = countPriceListsInFile,
PriceListItemManager = priceListItemManager
}, worksheet);
}
/// <returns>A task that represents the asynchronous operation</returns>
protected virtual async Task ImportOrderItemAsync(PropertyManager<OrderItem> orderItemManager, Order lastLoadedOrder)
{
if (lastLoadedOrder == null || orderItemManager.IsCaption)
return;
var orderItemGuid = Guid.TryParse(orderItemManager.GetDefaultProperty("OrderItemGuid").StringValue, out var guidValue) ? guidValue : Guid.NewGuid();
View on GitHub (pinned to 64bdf2ff08)
Solutions
- Import/seed the referenced products first so every SKU resolves, then re-run the price-list import.
- Export current SKUs and diff against the price-list file to catch typos/whitespace/casing.
- Remove price-list rows for SKUs that have no product.
- Keep SKUs stable across environments when migrating price lists.
Example fix
// before
await _importManager.ImportPriceListsFromXlsxAsync(stream);
// after — validate price-list SKUs up front
var existingSkus = (await _productService.SearchProductsAsync(0, int.MaxValue)).products.Select(p => p.Sku).Where(s => !string.IsNullOrWhiteSpace(s)).ToHashSet(StringComparer.OrdinalIgnoreCase);
var badSkus = priceListItemSkus.Where(s => !existingSkus.Contains(s.Trim())).ToList();
if (badSkus.Any())
return BadRequest($"These product SKUs do not exist: {string.Join(", ", badSkus)}");
await _importManager.ImportPriceListsFromXlsxAsync(stream); Defensive patterns
Strategy: validation
Validate before calling
// Pre-validate price-list-item SKUs against existing products
var skus = (await _productService.SearchProductsAsync(0, int.MaxValue)).products
.Select(p => p.Sku).Where(s => !string.IsNullOrWhiteSpace(s))
.ToHashSet(StringComparer.OrdinalIgnoreCase);
var bad = priceListItemSkus.Where(s => !skus.Contains(s.Trim())).ToList();
if (bad.Any())
return BadRequest($"These product SKUs do not exist: {string.Join(", ", bad)}");
await _importManager.ImportPriceListsFromXlsxAsync(stream); Try / catch
try { await _importManager.ImportPriceListsFromXlsxAsync(stream); }
catch (ArgumentException ex) when (ex.Message.Contains("ProductsDontExist"))
{ /* show the missing price-list SKUs */ } Prevention
- Ensure the catalog has the referenced products before importing a price list.
- Reconcile SKUs (whitespace/casing) between the price list and the catalog.
- Drop price-list rows whose SKUs are not in the catalog.
When it happens
Trigger: Calling the price-list import path with an XLSX whose price-list-item SKU column references SKUs that have no matching Product. Fires after the worksheet scan, just before ImportPriceListMetadata is returned.
Common situations: Price-list spreadsheet references products not yet imported; SKUs changed or were deleted after the price list was built; whitespace/casing mismatches in SKUs; importing a vendor price list against a catalog that lacks those products.
Related errors
- Admin.Orders.Import.ProductsDontExist
- Admin.Catalog.Products.Import.CategoriesDontExist
- Admin.Catalog.Products.Import.ManufacturersDontExist
- Admin.Catalog.Products.Import.ProductAttributesDontExist
- The following specification attribute option ID(s) don't exi
AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13).
Data as JSON: /api/errors/bcae54f42fea2d36.
Report an issue: GitHub.