rocksdanister/lively · warning · InvalidOperationException

A LivelyInfo.json file was found in this project folder. It

Error message

A LivelyInfo.json file was found in this project folder.
It looks like this project is already packaged.
To create a new project, please remove the existing LivelyInfo.json first.

What it means

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.

Source

Thrown at src/Lively/Lively.Common/Factories/WallpaperLibraryFactory.cs:122

        {
            return new LibraryModel()
            {
                LivelyInfo = metadata,
                Title = metadata.Title,
                Desc = metadata.Desc,
                Author = metadata.Author,
                ImagePath = File.Exists(metadata.Preview) ? metadata.Preview : metadata.Thumbnail,
            };
        }

        public LivelyInfoModel CreateWallpaperPackage(string filePath, string destDirectory, WallpaperType type, string arguments = null)
        {
            if (type.IsDirectoryProject())
            {
                var folderPath = Path.GetDirectoryName(filePath);
                var metadaPath = Path.Combine(folderPath, "LivelyInfo.json");
                if (File.Exists(metadaPath))
                    throw new InvalidOperationException("A LivelyInfo.json file was found in this project folder.\n" +
                        "It looks like this project is already packaged.\n" +
                        "To create a new project, please remove the existing LivelyInfo.json first.");
            }

            var metadata = new LivelyInfoModel()
            {
                Title = type.IsOnlineWallpaper() ? 
                    LinkUtil.GetLastSegmentUrl(filePath) : Path.GetFileNameWithoutExtension(filePath),
                Type = type,
                IsAbsolutePath = true,
                FileName = filePath,
                Contact = type.IsOnlineWallpaper() ? filePath : string.Empty,
                Preview = string.Empty,
                Thumbnail = string.Empty,
                Arguments = arguments,
            };

            Directory.CreateDirectory(destDirectory);

View on GitHub (pinned to c1036feb66)

Solutions

  1. Delete the existing LivelyInfo.json in the project folder before re-packaging.
  2. Package into a fresh/clean working directory so no stale manifest lingers.
  3. Pre-check: if File.Exists(manifest) and you intend a brand-new package, treat it as user intent to overwrite only after explicit confirmation.

Example fix

// before
if (File.Exists(metadaPath))
    throw new InvalidOperationException("...already packaged...");

// after (allow explicit repack via flag)
if (File.Exists(metadaPath) && !overwriteExisting)
    throw new InvalidOperationException("...already packaged; pass overwriteExisting to repack.");
Defensive patterns

Strategy: validation

Validate before calling

string manifest = Path.Combine(Path.GetDirectoryName(filePath), "LivelyInfo.json");
if (File.Exists(manifest))
    throw new InvalidOperationException("Project already packaged; delete LivelyInfo.json to repackage.");
factory.CreateWallpaperPackage(filePath, destDirectory, type, arguments);

Type guard

static bool IsAlreadyPackaged(string filePath)
    => File.Exists(Path.Combine(Path.GetDirectoryName(filePath) ?? "", "LivelyInfo.json"));

Try / catch

try { factory.CreateWallpaperPackage(filePath, dest, type, args); }
catch (InvalidOperationException ex) when (ex.Message.Contains("already packaged"))
{ /* ask user to confirm overwrite */ }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of rocksdanister/lively@c1036feb66 (2026-08-13). Data as JSON: /api/errors/6c1b5a8a28b84dbf. Report an issue: GitHub.