ERROR_NOT_EMPTY - 4307 (0x10D3)
The library, drive, or media pool must be empty to perform this operation.
Updated: Feb 21, 2026
Technical Background
The ERROR_NOT_EMPTY error code, with the numeric value of 4307 and hexadecimal representation 0x10D3, indicates that an operation cannot be performed on a library, drive, or media pool because it contains items. This error is specific to file system operations where an empty state is required.
Error Details
The ERROR_NOT_EMPTY error typically occurs when attempting to perform actions such as deleting a directory, ejecting a drive, or unmounting a volume that still contains files, subdirectories, or other data objects. This error code is part of the Windows API and is used by various system components and applications to enforce certain operational constraints.
Common Causes
- Invalid Parameter Values: The operation was attempted on an object that is not empty, such as a directory containing files or subdirectories.
- Incorrect Object Type: The operation was intended for an object type that requires emptiness, but the targeted object contains data.
- Exceeding Limits: The system may have limitations on operations that require emptiness, and these limits were exceeded.
Real-World Context
This error is commonly encountered in scenarios where a user or application attempts to perform actions such as:
- Deleting a directory that still has files or subdirectories within it.
- Ejecting a removable drive that contains unsaved data.
- Unmounting a volume that still has open handles or active processes using its resources.
Is This Error Critical?
The criticality of this error depends on the specific operation and context. In many cases, it is not a fatal error but rather an informational message indicating that the operation cannot proceed as intended until the object becomes empty.
How to Diagnose
To diagnose ERROR_NOT_EMPTY, follow these steps:
- Review Operation Context: Ensure that the operation being performed is appropriate for the state of the targeted object. Verify that no files or subdirectories are present in the directory before attempting to delete it.
- Validate Parameters: Check the parameters passed to the API call to ensure they correctly identify an empty object. Incorrect parameter values can lead to this error.
- Confirm Object Types: Ensure that the operation is being performed on a type of object that requires emptiness, such as a directory or drive, and not on other types like files or registry keys.
How to Resolve
To resolve ERROR_NOT_EMPTY, follow these practical steps:
- Correct Parameter Usage: Ensure that all parameters are correctly set to target an empty object. For example, when deleting a directory, make sure it is empty before attempting the operation.
- Adjust Operation Context: If the operation cannot be performed due to the presence of data, consider performing alternative actions such as moving or archiving files before proceeding with the intended operation.
- Restore Data: In cases where data needs to be preserved, ensure that all necessary files and subdirectories are backed up before attempting to delete the directory or unmount the volume.
Developer Notes
When developing applications that interact with file systems, it is crucial to handle ERROR_NOT_EMPTY appropriately. Ensure that operations requiring an empty state are preceded by checks to confirm emptiness. This can be achieved through API calls such as FindFirstFile, GetFileInformationByHandle, or similar functions.
Related Errors
- ERROR_DIR_NOT_EMPTY (412): Similar error for directory operations where the directory is not empty.
- ERROR_MEDIA_IN_USE (387): Occurs when a drive cannot be ejected because it is in use by an application or process.
FAQ
Q: What does ERROR_NOT_EMPTY mean?
A: The operation requires that the targeted object, such as a directory or drive, be empty. If the object contains data, this error will occur.
Q: How can I avoid ERROR_NOT_EMPTY?
A: Ensure that any operations requiring an empty state are preceded by checks to confirm emptiness and that all necessary files or subdirectories are removed before performing the operation.
Summary
The ERROR_NOT_EMPTY error code is a specific technical indicator used in Windows file system operations. It ensures that certain actions, such as deleting directories or unmounting drives, can only proceed if the targeted objects are empty. Understanding this error and its implications is crucial for developers working with file systems to ensure robust and reliable application behavior.