{"record":{"id":"75f21c5e81432ba0","repo":"nopSolutions/nopCommerce","slug":"archive-nopcommondefaults-localepatternarchivena","errorCode":null,"errorMessage":"Archive '{NopCommonDefaults.LocalePatternArchiveName}' to retrieve localization patterns not found.","messagePattern":"Archive '(.+?)' to retrieve localization patterns not found\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/Libraries/Nop.Services/Plugins/UploadService.cs","lineNumber":438,"sourceCode":"    public virtual Task UploadLocalePatternAsync(CultureInfo cultureInfo = null)\n    {\n        string getPath(string dirPath, string dirName)\n        {\n            return _fileProvider.GetAbsolutePath(string.Format(dirPath, dirName));\n        }\n\n        bool checkDirectoryExists(string dirPath, string dirName)\n        {\n            return _fileProvider.DirectoryExists(getPath(dirPath, dirName));\n        }\n\n        var tempFolder = \"temp\";\n        try\n        {\n            //1. check if the archive with localization of templates is in its place\n            var zipLocalePatternPath = getPath(NopCommonDefaults.LocalePatternPath, NopCommonDefaults.LocalePatternArchiveName);\n            if (!_fileProvider.GetFileExtension(zipLocalePatternPath)?.Equals(\".zip\", StringComparison.InvariantCultureIgnoreCase) ?? true)\n                throw new Exception($\"Archive '{NopCommonDefaults.LocalePatternArchiveName}' to retrieve localization patterns not found.\");\n\n            var currentCulture = cultureInfo ?? CultureInfo.CurrentCulture;\n\n            //2. Check if there is already an unpacked folder with locales for the current culture in the lib directory, if not then\n            if (!(checkDirectoryExists(NopCommonDefaults.LocalePatternPath, currentCulture.Name) ||\n                  checkDirectoryExists(NopCommonDefaults.LocalePatternPath, currentCulture.TwoLetterISOLanguageName)))\n            {\n                var cultureToUse = string.Empty;\n\n                //3. Unpack the archive into a temporary folder\n                ZipFile.ExtractToDirectory(zipLocalePatternPath, getPath(NopCommonDefaults.LocalePatternPath, tempFolder));\n\n                //4. Search in the temp unpacked archive a folder with locales by culture\n                var sourceLocalePath = _fileProvider.Combine(getPath(NopCommonDefaults.LocalePatternPath, tempFolder), currentCulture.Name);\n                if (_fileProvider.DirectoryExists(sourceLocalePath))\n                    cultureToUse = currentCulture.Name;\n\n                var sourceLocaleISOPath = _fileProvider.Combine(getPath(NopCommonDefaults.LocalePatternPath, tempFolder), currentCulture.TwoLetterISOLanguageName);","sourceCodeStart":420,"sourceCodeEnd":456,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Libraries/Nop.Services/Plugins/UploadService.cs#L420-L456","documentation":"Thrown by UploadService when initializing localization patterns: it builds zipLocalePatternPath from NopCommonDefaults.LocalePatternPath + LocalePatternArchiveName and throws if _fileProvider.GetFileExtension of that PATH string is not '.zip'. The message says 'not found' but the actual guard is an extension check on the configured archive name/path, not a real FileExists call.","triggerScenarios":"The LocalePatternArchiveName default no longer ends in '.zip' (e.g. changed to .nupkg), the path is misconfigured, or the archive file is missing AND the configured name lacks a .zip extension. Reachable during a culture/locale initialization path that unpacks locale templates.","commonSituations":"A custom build strips or renames the locale pattern archive; an upgrade changes NopCommonDefaults.LocalePatternArchiveName; the file was never deployed to wwwroot/lib.","solutions":["Ensure the locale pattern archive file named by NopCommonDefaults.LocalePatternArchiveName exists in NopCommonDefaults.LocalePatternPath and ends in '.zip'.","If you intentionally changed the archive format, update the default constant to keep the '.zip' extension.","Redeploy the missing archive from a clean nopCommerce distribution package."],"exampleFix":"// before: archive name lacks .zip\npublic const string LocalePatternArchiveName = \"locale_patterns\";\n// after:\npublic const string LocalePatternArchiveName = \"locale_patterns.zip\";","handlingStrategy":"validation","validationCode":"var archivePath = Path.Combine(NopCommonDefaults.LocalePatternPath, NopCommonDefaults.LocalePatternArchiveName);\nif (!string.Equals(Path.GetExtension(archivePath), \".zip\", StringComparison.OrdinalIgnoreCase)\n    || !_fileProvider.FileExists(archivePath))\n    // deploy/fix archive before invoking localization init","typeGuard":"static bool LocaleArchiveReady(INopFileProvider fp)\n{\n    var p = Path.Combine(NopCommonDefaults.LocalePatternPath, NopCommonDefaults.LocalePatternArchiveName);\n    return string.Equals(Path.GetExtension(p), \".zip\", StringComparison.OrdinalIgnoreCase) && fp.FileExists(p);\n}","tryCatchPattern":"try { await uploadService.EnsureLocalePatternsAsync(culture); }\ncatch (Exception ex) when (ex.Message.Contains(\"LocalePatternArchiveName\"))\n{ logger.Error(\"Locale pattern archive missing/invalid: \" + ex.Message); }","preventionTips":["Keep LocalePatternArchiveName ending in .zip in defaults.","Deploy the locale archive as part of CI.","Add a FileExists check, which the current guard omits."],"tags":["plugins","localization","config","file-extension","zip"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}