{"record":{"id":"e3ba7eb19ac9eba8","repo":"nopSolutions/nopCommerce","slug":"admin-catalog-products-import-storesdontexist","errorCode":null,"errorMessage":"Admin.Catalog.Products.Import.StoresDontExist","messagePattern":"Admin\\.Catalog\\.Products\\.Import\\.StoresDontExist","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Libraries/Nop.Services/ExportImport/ImportManager.cs","lineNumber":1452,"sourceCode":"        //performance optimization, the check for the existence of the manufacturers in one SQL request\r\n        var notExistingManufacturers = await _manufacturerService.GetNotExistingManufacturersAsync(allManufacturers.ToArray());\r\n        if (notExistingManufacturers.Any())\r\n            throw new ArgumentException(string.Format(await _localizationService.GetResourceAsync(\"Admin.Catalog.Products.Import.ManufacturersDontExist\"), string.Join(\", \", notExistingManufacturers)));\r\n\r\n        //performance optimization, the check for the existence of the product attributes in one SQL request\r\n        var notExistingProductAttributes = await _productAttributeService.GetNotExistingAttributesAsync(allAttributeIds.ToArray());\r\n        if (notExistingProductAttributes.Any())\r\n            throw new ArgumentException(string.Format(await _localizationService.GetResourceAsync(\"Admin.Catalog.Products.Import.ProductAttributesDontExist\"), string.Join(\", \", notExistingProductAttributes)));\r\n\r\n        //performance optimization, the check for the existence of the specification attribute options in one SQL request\r\n        var notExistingSpecificationAttributeOptions = await _specificationAttributeService.GetNotExistingSpecificationAttributeOptionsAsync(allSpecificationAttributeOptionIds.Where(saoId => saoId != 0).ToArray());\r\n        if (notExistingSpecificationAttributeOptions.Any())\r\n            throw new ArgumentException($\"The following specification attribute option ID(s) don't exist - {string.Join(\", \", notExistingSpecificationAttributeOptions)}\");\r\n\r\n        //performance optimization, the check for the existence of the stores in one SQL request\r\n        var notExistingStores = await _storeService.GetNotExistingStoresAsync(allStores.ToArray());\r\n        if (notExistingStores.Any())\r\n            throw new ArgumentException(string.Format(await _localizationService.GetResourceAsync(\"Admin.Catalog.Products.Import.StoresDontExist\"), string.Join(\", \", notExistingStores)));\r\n\r\n        return new ImportProductMetadata\r\n        {\r\n            EndRow = endRow,\r\n            Manager = manager,\r\n            Properties = defaultProperties,\r\n            ProductsInFile = productsInFile,\r\n            ProductAttributeManager = productAttributeManager,\r\n            DefaultWorksheet = defaultWorksheet,\r\n            LocalizedWorksheets = metadata.LocalizedWorksheets,\r\n            SpecificationAttributeManager = specificationAttributeManager,\r\n            TierPriceManager = tierPriceManager,\r\n            SkuCellNum = skuCellNum,\r\n            AllSku = allSku,\r\n            RequiredProductsData = requiredProductsData\r\n        };\r\n    }\r\n\r","sourceCodeStart":1434,"sourceCodeEnd":1470,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Libraries/Nop.Services/ExportImport/ImportManager.cs#L1434-L1470","documentation":"Thrown during product XLSX import when store IDs referenced in the spreadsheet do not exist in the database. nopCommerce batches all referenced store IDs into a single SQL check (GetNotExistingStoresAsync) and aborts the entire import with an ArgumentException listing the missing IDs.","triggerScenarios":"Calling the product-import path with an XLSX whose Store IDs / Limited to Stores columns reference store IDs that have no matching record. Fires after the specification-option check, just before ImportProductMetadata is returned.","commonSituations":"Spreadsheet uses store IDs from another environment whose stores were never migrated; a store was deleted after export; multi-store setup changed and IDs shifted; importing against a single-store DB with multi-store IDs in the file.","solutions":["Confirm the store IDs in the file against the current Stores list (Configuration > Stores); create or fix them before re-importing.","Remove the store-mapping cells (or set them to the single existing store) when the target environment has fewer stores.","When migrating, ensure stores are created with the same IDs before importing products.","If running multi-store, verify the admin is logged into the correct store scope."],"exampleFix":"// before\nawait _importManager.ImportProductsFromXlsxAsync(stream);\n\n// after — validate store IDs up front\nvar validStoreIds = (await _storeService.GetAllStoresAsync()).Select(s => s.Id).ToHashSet();\nvar badStoreIds = referencedStoreIds.Where(id => !validStoreIds.Contains(id)).ToList();\nif (badStoreIds.Any())\n    return BadRequest($\"These store IDs do not exist: {string.Join(\", \", badStoreIds)}\");\nawait _importManager.ImportProductsFromXlsxAsync(stream);","handlingStrategy":"validation","validationCode":"// Pre-validate store IDs referenced in the import\nvar validStoreIds = (await _storeService.GetAllStoresAsync()).Select(s => s.Id).ToHashSet();\nvar bad = referencedStoreIds.Where(id => !validStoreIds.Contains(id)).ToList();\nif (bad.Any())\n    return BadRequest($\"These store IDs do not exist: {string.Join(\", \", bad)}\");\nawait _importManager.ImportProductsFromXlsxAsync(stream);","typeGuard":null,"tryCatchPattern":"try { await _importManager.ImportProductsFromXlsxAsync(stream); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"StoresDontExist\"))\n{ /* surface the missing store IDs */ }","preventionTips":["When migrating, create stores with the same IDs before importing products.","In single-store setups, clear store-mapping cells rather than referencing other store IDs.","Reconcile store IDs between export and import environments."],"tags":["import","multistore","stores","nopcommerce"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}