lucasg/Dependencies · error
[x] Could not find file {0:s} on disk
Error message
[x] Could not find file {0:s} on disk What it means
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.
Source
Thrown at Dependencies/Program.cs:876
DumpUsage();
return;
}
BinaryCache.InitializeBinaryCache(use_bin_cache);
if (eps.Count == 0)
{
Console.Error.WriteLine("[x] Command {0:s} needs to have a PE <FILE> argument", command.Method.Name);
Console.Error.WriteLine("");
DumpUsage();
return;
}
String FileName = eps[0];
if (!NativeFile.Exists(FileName))
{
Console.Error.WriteLine("[x] Could not find file {0:s} on disk", FileName);
return;
}
Debug.WriteLine("[-] Loading file {0:s} ", FileName);
PE Pe = new PE(FileName);
if (!Pe.Load())
{
Console.Error.WriteLine("[x] Could not load file {0:s} as a PE", FileName);
return;
}
command(Pe, GetObjectPrinter(export_as_json), recursion_depth);
}
}
}
View on GitHub (pinned to 1997a40000)
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.
Defensive patterns
Strategy: validation
Validate before calling
// Use the same existence check Dependencies uses (handles WOW64 redirection + directories).
if (!NativeFile.Exists(fileName))
{
Console.Error.WriteLine($"[x] Could not find file {fileName} on disk");
return;
}
// alternatively, for pure managed callers:
// if (!System.IO.File.Exists(fileName)) { ... } Prevention
- NativeFile.Exists returns false for directories - ensure the path points at a file.
- Use absolute paths to avoid working-directory-dependent resolution.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- [x] "Malformed" pe manifest for file {0:s} : {1:s}
- [x] Exception : {0:s}
- - "{0:s}"
- [!] Unhandled exception occured while processing "{1:s}"
- Stacktrace: {0:s}
AI-assisted analysis of lucasg/Dependencies@1997a40000 (2026-08-13).
Data as JSON: /api/errors/6292d1f2ae3756a5.
Report an issue: GitHub.