| Previous | Next |
| EPERM | ESRCH |
ENOENT
Why “file not found” can be misleading
ENOENT does not prove that the final filename was misspelled. Path resolution walks every component between the starting directory and the final name. The result can therefore mean that an intermediate directory is missing, a symbolic link is dangling, the current working directory is not what the program assumed, or a required interpreter or loader cannot be found while starting an executable.
Relative paths deserve special attention in services, scheduled jobs, containers, and IDE launch configurations. They are resolved from the process working directory, not from the executable’s directory. An openat()-style API can instead interpret a relative path from a supplied directory descriptor.
How to investigate
- Log the exact path after variable expansion and record the current working directory or directory descriptor used by the call.
- Check every path component, including symlink targets and mount points, rather than checking only the leaf name.
- For an execution failure, inspect the script interpreter line and the executable’s dynamic-loader and library dependencies.
- When a file is expected to appear asynchronously, distinguish a genuine race from a permanent configuration error before retrying.
References
- Linux manual: path_resolution(7)
- Linux manual: open(2)
- Linux manual: execve(2)
- FreeBSD manual: open(2)
Looking for a different code? Search another status or error code.
