{"record":{"id":"6c1b5a8a28b84dbf","repo":"rocksdanister/lively","slug":"a-livelyinfo-json-file-was-found-in-this-project-f","errorCode":null,"errorMessage":"A LivelyInfo.json file was found in this project folder.\nIt looks like this project is already packaged.\nTo create a new project, please remove the existing LivelyInfo.json first.","messagePattern":"A LivelyInfo\\.json file was found in this project folder\\.\nIt looks like this project is already packaged\\.\nTo create a new project, please remove the existing LivelyInfo\\.json first\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"warning","filePath":"src/Lively/Lively.Common/Factories/WallpaperLibraryFactory.cs","lineNumber":122,"sourceCode":"        {\n            return new LibraryModel()\n            {\n                LivelyInfo = metadata,\n                Title = metadata.Title,\n                Desc = metadata.Desc,\n                Author = metadata.Author,\n                ImagePath = File.Exists(metadata.Preview) ? metadata.Preview : metadata.Thumbnail,\n            };\n        }\n\n        public LivelyInfoModel CreateWallpaperPackage(string filePath, string destDirectory, WallpaperType type, string arguments = null)\n        {\n            if (type.IsDirectoryProject())\n            {\n                var folderPath = Path.GetDirectoryName(filePath);\n                var metadaPath = Path.Combine(folderPath, \"LivelyInfo.json\");\n                if (File.Exists(metadaPath))\n                    throw new InvalidOperationException(\"A LivelyInfo.json file was found in this project folder.\\n\" +\n                        \"It looks like this project is already packaged.\\n\" +\n                        \"To create a new project, please remove the existing LivelyInfo.json first.\");\n            }\n\n            var metadata = new LivelyInfoModel()\n            {\n                Title = type.IsOnlineWallpaper() ? \n                    LinkUtil.GetLastSegmentUrl(filePath) : Path.GetFileNameWithoutExtension(filePath),\n                Type = type,\n                IsAbsolutePath = true,\n                FileName = filePath,\n                Contact = type.IsOnlineWallpaper() ? filePath : string.Empty,\n                Preview = string.Empty,\n                Thumbnail = string.Empty,\n                Arguments = arguments,\n            };\n\n            Directory.CreateDirectory(destDirectory);","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/rocksdanister/lively/blob/c1036feb664960722e34bf4309042c247d6a909d/src/Lively/Lively.Common/Factories/WallpaperLibraryFactory.cs#L104-L140","documentation":"Thrown by CreateWallpaperPackage when packaging a directory-based project (type.IsDirectoryProject()) whose folder already contains a LivelyInfo.json. The manifest is auto-generated by packaging, so an existing one means the project is already packaged; the guard prevents silently overwriting/rewriting it.","triggerScenarios":"Calling CreateWallpaperPackage(filePath, destDirectory, type, arguments) where type is a directory project and Path.GetDirectoryName(filePath) already has a LivelyInfo.json next to the source.","commonSituations":"Re-running packaging on an already-packaged project folder; copying files from a packaged wallpaper into a new project and forgetting to delete its manifest; CI/scripts invoking packaging twice on the same working tree.","solutions":["Delete the existing LivelyInfo.json in the project folder before re-packaging.","Package into a fresh/clean working directory so no stale manifest lingers.","Pre-check: if File.Exists(manifest) and you intend a brand-new package, treat it as user intent to overwrite only after explicit confirmation."],"exampleFix":"// before\nif (File.Exists(metadaPath))\n    throw new InvalidOperationException(\"...already packaged...\");\n\n// after (allow explicit repack via flag)\nif (File.Exists(metadaPath) && !overwriteExisting)\n    throw new InvalidOperationException(\"...already packaged; pass overwriteExisting to repack.\");","handlingStrategy":"validation","validationCode":"string manifest = Path.Combine(Path.GetDirectoryName(filePath), \"LivelyInfo.json\");\nif (File.Exists(manifest))\n    throw new InvalidOperationException(\"Project already packaged; delete LivelyInfo.json to repackage.\");\nfactory.CreateWallpaperPackage(filePath, destDirectory, type, arguments);","typeGuard":"static bool IsAlreadyPackaged(string filePath)\n    => File.Exists(Path.Combine(Path.GetDirectoryName(filePath) ?? \"\", \"LivelyInfo.json\"));","tryCatchPattern":"try { factory.CreateWallpaperPackage(filePath, dest, type, args); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"already packaged\"))\n{ /* ask user to confirm overwrite */ }","preventionTips":["Package from a clean working directory each time.","Pre-check for an existing LivelyInfo.json and prompt for overwrite explicitly.","Keep source projects and packaged output in separate folders."],"tags":["packaging","validation","wallpaper","manifest","guard"],"backgroundTag":null,"analyzedSha":"c1036feb664960722e34bf4309042c247d6a909d","analyzedAt":"2026-08-13T13:03:12.648Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}