{"record":{"id":"d3c3d2137c0b6538","repo":"LorisYounger/VPet","slug":"can-not-find-file-path","errorCode":null,"errorMessage":"Can not find file: {Path}","messagePattern":"Can not find file: (.+?)","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"VPet-Simulator.Core/Graph/APNGAnimation.cs","lineNumber":113,"sourceCode":"            if (!(path is FileInfo file) || path.Extension.ToLowerInvariant() != \".png\")\n                return;\n\n            bool isLoop = info[(gbol)\"loop\"];\n            APNGAnimation pa = new APNGAnimation(graph, file.FullName, new GraphInfo(path, info), isLoop);\n            graph.AddGraph(pa);\n        }\n\n        private async Task startup()\n        {\n            while (Function.MemoryUsage() > PNGAnimation.MaxLoadMemory)\n            {\n                await Task.Delay(100);\n            }\n\n            try\n            {\n                if (!File.Exists(Path))\n                    throw new FileNotFoundException($\"Can not find file: {Path}\");\n\n                IsReady = false;\n                IsFail = false;\n                FailMessage = \"\";\n\n                var parsed = ParseApng(Path);\n                if (parsed.Frames.Count == 0)\n                    throw new InvalidDataException(\"No APNG frames found.\");\n\n                FrameWidth = parsed.CanvasWidth;\n                FrameHeight = parsed.CanvasHeight;\n                if (FrameWidth > GraphCore.Resolution)\n                {\n                    FrameWidth = GraphCore.Resolution;\n                    FrameHeight = (int)(FrameHeight * (GraphCore.Resolution / (double)parsed.CanvasWidth));\n                }\n                if (parsed.Frames.Count * FrameWidth >= 60000)\n                {","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/LorisYounger/VPet/blob/ffb9cc2a856244a0f91aa5ecf10d097bcdd4954f/VPet-Simulator.Core/Graph/APNGAnimation.cs#L95-L131","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nnew APNGAnimation(\"bg/anm_01.png\");\n// after\nvar path = Path.Combine(baseDir, \"bg\", \"anm_01.png\");\nif (File.Exists(path)) new APNGAnimation(path);","handlingStrategy":"validation","validationCode":"if (!File.Exists(path)) throw new FileNotFoundException($\"APNG asset missing: {path}\");","typeGuard":null,"tryCatchPattern":"try { var anim = new APNGAnimation(path); } catch (FileNotFoundException ex) { Log.Warn($\"missing animation: {ex.FileName}\"); /* fallback to static picture */ }","preventionTips":["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"],"tags":["file-io","animation","png"],"backgroundTag":"file-not-found","analyzedSha":"ffb9cc2a856244a0f91aa5ecf10d097bcdd4954f","analyzedAt":"2026-09-15T21:21:10.398Z","contentChangedAt":"2026-09-15T21:21:10.398Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}