| Previous | Next |
| STATUS_COULD_NOT_INTERPRET | STATUS_NOT_SUPPORTED |
STATUS_FILE_IS_A_DIRECTORY
STATUS_FILE_IS_A_DIRECTORY is a type mismatch. Windows resolved the name successfully, but the caller requested an operation or open mode that requires a data file and the target is a directory. The status is often associated with native create options such as FILE_NON_DIRECTORY_FILE.
Common programming causes
- A path assembled from configuration ends at a directory instead of the expected file name.
- Code passes a directory path to a routine that opens a regular file, maps file data, or expects stream content.
- A trailing separator, reparse point, or path normalization step changes the caller's assumption about the final object.
- A remote file-system implementation reports the target type differently from the client-side code's expectation.
What to do
Record the final resolved path and the exact create/open options. If directories are valid inputs, open them with directory-appropriate flags and use directory enumeration or metadata APIs instead of file-data operations. If only a regular file is valid, reject the configuration or command-line value before issuing the native request.
The inverse case is STATUS_NOT_A_DIRECTORY: there the caller expected a directory but the existing target is a regular file. Treating these statuses separately makes path-validation bugs much easier to diagnose.
See NtCreateFile, File-system open processing, and the SMB2 CREATE specification.
Looking for a different code? Search another status or error code.