{"record":{"id":"6292d1f2ae3756a5","repo":"lucasg/Dependencies","slug":"x-could-not-find-file-0-s-on-disk","errorCode":null,"errorMessage":"[x] Could not find file {0:s} on disk","messagePattern":"\\[x\\] Could not find file (.+?) on disk","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"Dependencies/Program.cs","lineNumber":876,"sourceCode":"\t\t\t\tDumpUsage();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tBinaryCache.InitializeBinaryCache(use_bin_cache);\n\n\t\t\tif (eps.Count == 0)\n            {\n                Console.Error.WriteLine(\"[x] Command {0:s} needs to have a PE <FILE> argument\", command.Method.Name);\n                Console.Error.WriteLine(\"\");\n\n                DumpUsage();\n                return;\n            }\n\n\t\t\tString FileName = eps[0];\n            if (!NativeFile.Exists(FileName))\n            {\n                Console.Error.WriteLine(\"[x] Could not find file {0:s} on disk\", FileName);\n                return;\n            }\n\n\t\t\tDebug.WriteLine(\"[-] Loading file {0:s} \", FileName);\n\t\t\tPE Pe = new PE(FileName);\n            if (!Pe.Load())\n            {\n                Console.Error.WriteLine(\"[x] Could not load file {0:s} as a PE\", FileName);\n                return;\n            }\n\n            command(Pe, GetObjectPrinter(export_as_json), recursion_depth);\n\n        }\n    }\n}\n","sourceCodeStart":858,"sourceCodeEnd":893,"githubUrl":"https://github.com/lucasg/Dependencies/blob/1997a40000b77bd3326cbc33672a7b9f78bb23f3/Dependencies/Program.cs#L858-L893","documentation":"Printed by Main (Program.cs:876) when NativeFile.Exists(FileName) returns false. NativeFile.Exists (ClrPhlib/src/managed/NativeFile.cpp:43-68) calls GetFileAttributes under disabled WOW64 FS redirection and requires the result to be valid AND not a directory, so this fires for missing files, inaccessible paths, and paths that resolve to a directory.","triggerScenarios":"The first positional argument resolves to a non-existent file, a directory, or a path the process cannot reach (permissions/UNC issues) under WOW64 FS redirection.","commonSituations":"Typo in the path; relative path run from the wrong working directory; pointing at a folder instead of an .exe/.dll; 32-bit/64-bit System32 redirection mismatch.","solutions":["Verify the path with `dir <path>` from the same shell before running Dependencies.","Use an absolute path and quote it if it contains spaces.","If analysing a 64-bit System32 binary from a 32-bit host, disable WOW64 redirection or use the matching Dependencies build."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Use the same existence check Dependencies uses (handles WOW64 redirection + directories).\nif (!NativeFile.Exists(fileName))\n{\n    Console.Error.WriteLine($\"[x] Could not find file {fileName} on disk\");\n    return;\n}\n// alternatively, for pure managed callers:\n// if (!System.IO.File.Exists(fileName)) { ... }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["NativeFile.Exists returns false for directories - ensure the path points at a file.","Use absolute paths to avoid working-directory-dependent resolution."],"tags":["cli","file-not-found","path"],"backgroundTag":null,"analyzedSha":"1997a40000b77bd3326cbc33672a7b9f78bb23f3","analyzedAt":"2026-08-13T18:14:41.696Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}