| Previous | Next |
| ENODEV | EISDIR |
ENOTDIR
Where path resolution stopped
ENOTDIR is more specific than “path not found.” During pathname resolution, a component before the final name must be a directory or resolve to one. If the process tries to continue through a regular file, device, or another nondirectory object, the operation fails with ENOTDIR. The same result can appear with *at-style APIs when a relative path is supplied with a descriptor that does not refer to a directory.
A trailing slash is another useful clue: it expresses an expectation that the final component is a directory. A file with that name can therefore produce ENOTDIR even though it exists.
How to investigate
- Split the logged path into components and inspect the first component that is not a directory.
- Check whether an environment variable, configuration key, or deployment substitution changed a directory path into a file path.
- For
openat(),renameat(), and similar calls, verify that the supplieddirfdis valid and refers to a directory. - Do not mask the condition by creating a missing directory until the expected object type is understood.
References
Looking for a different code? Search another status or error code.