{"record":{"id":"d06bb96548a342a5","repo":"nopSolutions/nopCommerce","slug":"admin-configuration-settings-generalcommon-favicon","errorCode":null,"errorMessage":"Admin.Configuration.Settings.GeneralCommon.FaviconAndAppIcons.MissingFile","messagePattern":"Admin\\.Configuration\\.Settings\\.GeneralCommon\\.FaviconAndAppIcons\\.MissingFile","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/Presentation/Nop.Web/Areas/Admin/Controllers/SettingController.cs","lineNumber":1857,"sourceCode":"\n            //load settings for a chosen store scope\n            var storeScope = await _storeContext.GetActiveStoreScopeConfigurationAsync();\n            var commonSettings = await _settingService.LoadSettingAsync<CommonSettings>(storeScope);\n\n            switch (_fileProvider.GetFileExtension(iconsFile.FileName))\n            {\n                case \".ico\":\n                    await _uploadService.UploadFaviconAsync(iconsFile);\n                    commonSettings.FaviconAndAppIconsHeadCode = string.Format(NopCommonDefaults.SingleFaviconHeadLink, storeScope, iconsFile.FileName);\n\n                    break;\n\n                case \".zip\":\n                    await _uploadService.UploadIconsArchiveAsync(iconsFile);\n\n                    var headCodePath = _fileProvider.GetAbsolutePath(string.Format(NopCommonDefaults.FaviconAndAppIconsPath, storeScope), NopCommonDefaults.HeadCodeFileName);\n                    if (!_fileProvider.FileExists(headCodePath))\n                        throw new Exception(string.Format(await _localizationService.GetResourceAsync(\"Admin.Configuration.Settings.GeneralCommon.FaviconAndAppIcons.MissingFile\"), NopCommonDefaults.HeadCodeFileName));\n\n                    using (var sr = new StreamReader(headCodePath))\n                        commonSettings.FaviconAndAppIconsHeadCode = await sr.ReadToEndAsync();\n\n                    break;\n\n                default:\n                    throw new InvalidOperationException(\"File is not supported.\");\n            }\n\n            await _settingService.SaveSettingOverridablePerStoreAsync(commonSettings, x => x.FaviconAndAppIconsHeadCode, true, storeScope);\n\n            //delete old favicon icon if exist\n            var oldFaviconIconPath = _fileProvider.GetAbsolutePath(string.Format(NopCommonDefaults.OldFaviconIconName, storeScope));\n            if (_fileProvider.FileExists(oldFaviconIconPath))\n                _fileProvider.DeleteFile(oldFaviconIconPath);\n\n            //activity log","sourceCodeStart":1839,"sourceCodeEnd":1875,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Areas/Admin/Controllers/SettingController.cs#L1839-L1875","documentation":"Thrown during favicon/app-icon upload (ChangeEncryptionKey-adjacent settings flow) when a .zip archive is uploaded but the expected head-code file (NopCommonDefaults.HeadCodeFileName) is not produced inside the extraction path. The localized 'MissingFile' message is formatted with the expected filename. It signals a malformed or incomplete icons archive.","triggerScenarios":"Uploading a .zip that does not contain the head-code file (e.g. html) at the expected location; zip with wrong folder structure; extraction silently failing; zip produced by an incompatible icon generator.","commonSituations":"Using a third-party favicon generator whose zip layout differs from nopCommerce's expected FaviconAndAppIconsPath; corrupted zip; partial upload; wrong default file name configured.","solutions":["Regenerate the icons archive with a tool that emits the head-code file at the expected path.","Inspect the zip contents and ensure NopCommonDefaults.HeadCodeFileName exists at the root of the extraction dir.","Try the .ico path instead if you only need a single favicon.","Confirm write permissions on the favicon path so extraction succeeds."],"exampleFix":"// before\nif (!_fileProvider.FileExists(headCodePath))\n    throw new Exception(string.Format(await _localizationService.GetResourceAsync(\"Admin.Configuration.Settings.GeneralCommon.FaviconAndAppIcons.MissingFile\"), NopCommonDefaults.HeadCodeFileName));\n\n// after\nif (!_fileProvider.FileExists(headCodePath))\n{\n    _notificationService.ErrorNotification($\"Icons archive is missing the '{NopCommonDefaults.HeadCodeFileName}' file.\");\n    return View(model);\n}","handlingStrategy":"validation","validationCode":"var headCodePath = _fileProvider.GetAbsolutePath(...);\nif (!_fileProvider.FileExists(headCodePath))\n    return ErrorResult($\"Icons archive is missing '{NopCommonDefaults.HeadCodeFileName}'.\");","typeGuard":"static bool ArchiveHasHeadCode(string extractedDir, string fileName)\n    => File.Exists(Path.Combine(extractedDir, fileName));","tryCatchPattern":"catch (Exception ex) when (ex.Message.Contains(\"MissingFile\"))\n{ _notificationService.ErrorNotification(ex.Message); return View(model); }","preventionTips":["Use an icon generator that emits the head-code file at the expected path.","Inspect the zip layout before upload.","Confirm write permissions on the favicon extraction path."],"tags":["nopcommerce","admin-controller","validation","file-upload","favicon","settings"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}