| Previous | Next |
| ERROR_CHECKOUT_REQUIRED | ERROR_FILE_TOO_LARGE |
ERROR_BAD_FILE_TYPE
The target rejects this file type
ERROR_BAD_FILE_TYPE is a Win32 result associated with uploads, downloads, document libraries, and security filtering. When ERROR_BAD_FILE_TYPE is returned, diagnosis should begin with the exact API, target object, and operation that produced it rather than with the message text alone.
What the result means
The file type has been blocked by policy or by the target service. For ERROR_BAD_FILE_TYPE, the practical meaning depends on the caller and on whether the affected object is local, remote, removable, policy-managed, or handled asynchronously. Diagnostics for ERROR_BAD_FILE_TYPE should retain its symbolic name, numeric value, and the operation name together.
What to check
- Compare the extension and detected content type with the destination allowlist.
- Check enterprise policy, antivirus, gateway, and document-library restrictions.
- Verify that the file was not renamed merely to disguise its real format.
- Record the policy source and rule without exposing sensitive file contents.
Recommended handling
Use an approved format or request a policy exception through the proper administrative process. Renaming the extension is not a valid fix and may create a security incident.
Developer notes
Code handling ERROR_BAD_FILE_TYPE should capture the failing API, resolved path or device identity, requested access, process identity, and the first observed error. After a call that reports ERROR_BAD_FILE_TYPE, read GetLastError() immediately because later cleanup or logging can overwrite the value. Retry ERROR_BAD_FILE_TYPE only when the specific condition is documented as transient, using a bounded delay and cancellation support.
References
- Microsoft: System error codes relevant to ERROR_BAD_FILE_TYPE
- Microsoft: File management context for ERROR_BAD_FILE_TYPE
Looking for a different code? Search another status or error code.
