LorisYounger/VPet · error · FileNotFoundException
Can not find file
Error message
Can not find file: {Path} What it means
APNGAnimation throws FileNotFoundException in its async load routine when the animation image path does not exist on disk. Before parsing, it explicitly checks File.Exists(Path) and fails fast with the path embedded in the message. This guards the parser from opening a nonexistent file.
Solutions
- Verify the file at Path exists before constructing APNGAnimation (File.Exists).
- Fix the path to be absolute or rooted against ExtensionValue.BaseDirectory instead of the process working directory.
- Reinstall/restore the missing animation asset.
- Check file name casing and extension on case-sensitive deployments.
Example fix
// before
new APNGAnimation("bg/anm_01.png");
// after
var path = Path.Combine(baseDir, "bg", "anm_01.png");
if (File.Exists(path)) new APNGAnimation(path); Defensive patterns
Strategy: validation
Validate before calling
if (!File.Exists(path)) throw new FileNotFoundException($"APNG asset missing: {path}"); Try / catch
try { var anim = new APNGAnimation(path); } catch (FileNotFoundException ex) { Log.Warn($"missing animation: {ex.FileName}"); /* fallback to static picture */ } Prevention
- Root all asset paths against BaseDirectory, never the process CWD
- Check File.Exists before constructing any animation
- Ship assets in an installer manifest and verify on startup
When it happens
Trigger: Calling the APNGAnimation public constructor / load with a Path that does not resolve to an existing file at load time, e.g. a missing texture in the game's Graph directory.
Common situations: Asset missing from install/pack, wrong working directory (relative paths resolved against the exe, not the expected folder), renamed or case-mismatched file names, save/mod loaders pointing at a deleted custom animation.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- No APNG frames found.
- Invalid PNG/APNG signature.
- Decode APNG frame bitmap failed.
- Invalid fcTL chunk.
- fdAT found before fcTL.
AI-assisted analysis of LorisYounger/VPet@ffb9cc2a85 (2026-09-15).
Data as JSON: /api/errors/d3c3d2137c0b6538.
Report an issue: GitHub.
Appendix: source
Thrown at VPet-Simulator.Core/Graph/APNGAnimation.cs:113
if (!(path is FileInfo file) || path.Extension.ToLowerInvariant() != ".png")
return;
bool isLoop = info[(gbol)"loop"];
APNGAnimation pa = new APNGAnimation(graph, file.FullName, new GraphInfo(path, info), isLoop);
graph.AddGraph(pa);
}
private async Task startup()
{
while (Function.MemoryUsage() > PNGAnimation.MaxLoadMemory)
{
await Task.Delay(100);
}
try
{
if (!File.Exists(Path))
throw new FileNotFoundException($"Can not find file: {Path}");
IsReady = false;
IsFail = false;
FailMessage = "";
var parsed = ParseApng(Path);
if (parsed.Frames.Count == 0)
throw new InvalidDataException("No APNG frames found.");
FrameWidth = parsed.CanvasWidth;
FrameHeight = parsed.CanvasHeight;
if (FrameWidth > GraphCore.Resolution)
{
FrameWidth = GraphCore.Resolution;
FrameHeight = (int)(FrameHeight * (GraphCore.Resolution / (double)parsed.CanvasWidth));
}
if (parsed.Frames.Count * FrameWidth >= 60000)
{View on GitHub (pinned to ffb9cc2a85)