rocksdanister/lively · error · FileNotFoundException
Corrupted wallpaper metadata
Error message
Corrupted wallpaper metadata
What it means
Thrown by GetMetadata when LivelyInfo.json exists but JsonStorage<LivelyInfoModel>.LoadData returns null, i.e. the JSON deserialised to null because it is empty, malformed, or does not match LivelyInfoModel. Note the exception TYPE is FileNotFoundException even though the cause is corruption — a leaky abstraction worth flagging.
Source
Thrown at src/Lively/Lively.Common/Factories/WallpaperLibraryFactory.cs:21
using Lively.Common.Helpers.Shell;
using Lively.Common.Helpers.Storage;
using Lively.Models;
using Lively.Models.Enums;
using System;
using System.Drawing.Imaging;
using System.IO;
using System.Threading.Tasks;
namespace Lively.Common.Factories
{
public class WallpaperLibraryFactory : IWallpaperLibraryFactory
{
public LivelyInfoModel GetMetadata(string folderPath)
{
if (!File.Exists(Path.Combine(folderPath, "LivelyInfo.json")))
throw new FileNotFoundException("LivelyInfo.json not found");
return JsonStorage<LivelyInfoModel>.LoadData(Path.Combine(folderPath, "LivelyInfo.json")) ?? throw new FileNotFoundException("Corrupted wallpaper metadata");
}
public LibraryModel CreateFromDirectory(string folderPath)
{
var metadata = GetMetadata(folderPath);
var result = new LibraryModel
{
LivelyInfo = metadata,
LivelyInfoFolderPath = folderPath,
LivelyInfoLocalizationPath = Path.Combine(folderPath, "LivelyInfo.loc.json"),
LivelyPropertyLocalizationPath = Path.Combine(folderPath, "LivelyProperties.loc.json"),
IsSubscribed = !string.IsNullOrEmpty(metadata.Id),
Title = metadata.Title,
Desc = metadata.Desc,
Author = metadata.Author
};
if (metadata.IsAbsolutePath)
{View on GitHub (pinned to c1036feb66)
Solutions
- Open LivelyInfo.json and validate it parses against the LivelyInfoModel schema (check required fields: Title, Type, FileName, etc.).
- Restore the manifest from a backup or re-package the wallpaper with CreateWallpaperPackage.
- Catch FileNotFoundException around GetMetadata and surface a 'corrupt wallpaper, re-import' message to the user rather than crashing.
- If maintaining the library, throw a more accurate exception type (e.g. InvalidDataException) so callers can distinguish missing-vs-corrupt.
Example fix
// before
return JsonStorage<LivelyInfoModel>.LoadData(path) ?? throw new FileNotFoundException("Corrupted wallpaper metadata");
// after (distinguish corrupt from missing, accurate type)
LivelyInfoModel tmp;
try { tmp = JsonStorage<LivelyInfoModel>.LoadData(path); }
catch (Exception ex) { throw new InvalidDataException("LivelyInfo.json is not valid JSON", ex); }
return tmp ?? throw new InvalidDataException("LivelyInfo.json deserialised to null"); Defensive patterns
Strategy: try-catch
Validate before calling
var json = File.ReadAllText(manifestPath);
if (string.IsNullOrWhiteSpace(json))
throw new InvalidDataException("LivelyInfo.json is empty");
JsonConvert.DeserializeObject<LivelyInfoModel>(json); // throws JsonException on malformed Type guard
static bool TryParseManifest(string path, out LivelyInfoModel model)
{
model = default;
try { model = JsonConvert.DeserializeObject<LivelyInfoModel>(File.ReadAllText(path)); }
catch { return false; }
return model != null;
} Try / catch
try { meta = factory.GetMetadata(folderPath); }
catch (FileNotFoundException ex) when (ex.Message.Contains("Corrupted"))
{
// offer to re-import / restore from backup
} Prevention
- Never hand-edit LivelyInfo.json; use the packaging tooling.
- Treat missing-vs-corrupt as distinct cases (the exception type is misleading — match on message or validate first).
- Back up manifests before migration/export.
When it happens
Trigger: LivelyInfo.json present but empty, truncated, syntactically invalid JSON, or a schema that does not bind to LivelyInfoModel (missing required fields, wrong type). The null-coalesce `?? throw` fires when the deserializer yields null.
Common situations: User hand-edited the manifest and broke it; a half-written file from a crashed save; version skew where an older/newer LivelyInfoModel shape no longer matches the file; encoding issues (BOM/UTF-16) confusing Newtonsoft.Json.
Related errors
- json null/corrupt
- LivelyInfo.json not found
- A LivelyInfo.json file was found in this project folder. It
- LivelyInfo.json not found
- Not Lively .zip
AI-assisted analysis of rocksdanister/lively@c1036feb66 (2026-08-13).
Data as JSON: /api/errors/90737604392f2db5.
Report an issue: GitHub.