ERROR_DIR_NOT_EMPTY - 145 (0x91)

The directory is not empty.

Updated: Feb 21, 2026

Technical Meaning

The ERROR_DIR_NOT_EMPTY error code indicates that an operation intended for a directory could not be completed because the specified directory contains files or subdirectories. This error is specific to file system operations and is commonly encountered when attempting to delete, rename, or modify a directory.

Error Details

  • Error Name: ERROR_DIR_NOT_EMPTY
  • Numeric Code: 145 (0x91)
  • Short Description: The directory is not empty.

This error typically occurs during operations such as:

  • Deleting a directory that contains files or subdirectories.
  • Renaming a directory when it is not empty.
  • Modifying the attributes of an empty directory if it is intended to be non-empty.

Usage Context

The ERROR_DIR_NOT_EMPTY error code is returned by various file system APIs and functions in the Windows operating system. It is used to indicate that the operation could not proceed because the target directory contains items other than subdirectories, which are themselves empty directories or files.

Developer Interpretation

Developers should interpret this error as a condition where an intended operation cannot be completed due to the presence of non-empty content within the specified directory. This can affect operations such as directory deletion, renaming, and modification of attributes that require an empty state for successful completion.

Related Errors

  • ERROR_DIR_NOT_FOUND: The specified directory does not exist.
  • ERROR_PATH_NOT_FOUND: The specified path is invalid or does not exist.
  • ERROR_ACCESS_DENIED: Access to the directory is denied due to insufficient permissions.
  • ERROR_INVALID_PARAMETER: An invalid parameter was passed to the function.

FAQ

Q: Can this error be ignored?

A: No, this error should be handled as it indicates a condition that prevents the intended operation from completing successfully. Ignoring it may result in partial operations or data loss.

Q: What are common causes of this error?

A: Common causes include attempting to delete a directory with files or subdirectories, renaming an empty directory, or modifying attributes of a non-empty directory.

Summary

The ERROR_DIR_NOT_EMPTY error code is specific to file system operations and indicates that the target directory contains items other than subdirectories. Developers should handle this error by ensuring directories are empty before performing certain operations such as deletion or renaming. Proper handling can prevent data loss and ensure the integrity of file system operations.