{"record":{"id":"389f822b3353d05e","repo":"rocksdanister/lively","slug":"i18n-getstring-livelyexceptionnotlivelyzip","errorCode":null,"errorMessage":"i18n.GetString(\"LivelyExceptionNotLivelyZip\")","messagePattern":"i18n\\.GetString\\(\"LivelyExceptionNotLivelyZip\"\\)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"warning","filePath":"src/Lively/Lively.UI.Shared/ViewModels/LibraryViewModel.cs","lineNumber":586,"sourceCode":"                        // We do not autoSetWallpaper for .zip\n                        return AddWallpaper(installDir);\n                    }\n                    catch (Exception)\n                    {\n                        try\n                        {\n                            Directory.Delete(installDir, true);\n                        }\n                        catch { /* Nothing to do */ }\n                    }\n                    finally\n                    {\n                        semaphoreSlimInstallLock.Release();\n                    }\n                }\n                else\n                {\n                    throw new InvalidOperationException(i18n.GetString(\"LivelyExceptionNotLivelyZip\"));\n                }\n            }\n            else if (FileTypes.GetFileType(filePath) is not (WallpaperType)(-1) and var fileType)\n            {\n                if (mediaFormatConverter.RequiresConversion(filePath, out var newExt))\n                {\n                    if (!await dialogService.ShowConfirmationDialogAsync($\"{i18n.GetString(\"DescriptionConfirmFileConvertion/Text\")}\"))\n                        return null;\n\n                    var fileName = Path.GetFileNameWithoutExtension(filePath) + newExt;\n                    var outPath = Path.Combine(Constants.CommonPaths.TempDir, fileName);\n\n                    if (!await mediaFormatConverter.TryConvertAsync(filePath, outPath))\n                        return null;\n\n                    filePath = outPath;\n                    fileType = FileTypes.GetFileType(filePath);\n                }","sourceCodeStart":568,"sourceCodeEnd":604,"githubUrl":"https://github.com/rocksdanister/lively/blob/c1036feb664960722e34bf4309042c247d6a909d/src/Lively/Lively.UI.Shared/ViewModels/LibraryViewModel.cs#L568-L604","documentation":"Thrown by LibraryViewModel.AddWallpaperFile in a different non-package else branch — same intent as error 11 (file is not a valid lively package) but using the localized string LivelyExceptionNotLivelyZip. Fires on a content-check failure where the extension path took a different branch.","triggerScenarios":"AddWallpaperFile on a file whose extension suggested a package but the package-content check fails (IsWallpaperPackage false), landing in this else branch.","commonSituations":"Same as error 11: mis-named archives, repackaged/incomplete lively packages, third-party zips with the wrong extension.","solutions":["Use a known-good lively package file.","Pre-screen dropped files with FileTypes.IsWallpaperPackage and show a friendly localized error before invoking AddWallpaperFile.","If you control packaging, ensure CreateWallpaperPackage writes the marker/manifest the validator expects."],"exampleFix":"// before\nthrow new InvalidOperationException(i18n.GetString(\"LivelyExceptionNotLivelyZip\"));\n\n// after — guard earlier and give the user a recovery path\nif (!FileTypes.IsWallpaperPackage(filePath))\n{\n    await dialogService.ShowMessageAsync(i18n.GetString(\"LivelyExceptionNotLivelyZip\"));\n    return null;\n}","handlingStrategy":"validation","validationCode":"if (FileTypes.IsWallpaperPackageExtension(filePath) && !FileTypes.IsWallpaperPackage(filePath))\n{\n    await dialogService.ShowMessageAsync(i18n.GetString(\"LivelyExceptionNotLivelyZip\"));\n    return;\n}","typeGuard":"static bool IsAddablePackage(string filePath)\n    => FileTypes.IsWallpaperPackageExtension(filePath) && FileTypes.IsWallpaperPackage(filePath);","tryCatchPattern":"try { await libraryViewModel.AddWallpaperFile(filePath, autoSetWallpaper); }\ncatch (InvalidOperationException) { ShowError(i18n.GetString(\"LivelyExceptionNotLivelyZip\")); }","preventionTips":["Validate package content before invoking AddWallpaperFile.","Surface the localized message instead of letting the exception reach the user raw.","Re-package with CreateWallpaperPackage to fix corrupt archives."],"tags":["wallpaper","zip","validation","i18n","file-type"],"backgroundTag":null,"analyzedSha":"c1036feb664960722e34bf4309042c247d6a909d","analyzedAt":"2026-08-13T13:03:12.648Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}