What does Windows error code 222 (ERROR_BAD_FILE_TYPE) mean?

 
Could be also:
ConstantTypeOS
POOL_CORRUPTION_IN_FILE_AREABugCheck CodeWindows
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., 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. The practical meaning depends on the caller and on whether the affected object is local, remote, removable, policy-managed, or handled asynchronously. Diagnostics for it 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 this result should capture the failing API, resolved path or device identity, requested access, process identity, and the first observed error. After a call that reports it, read GetLastError() immediately because later cleanup or logging can overwrite the value. Retry it only when the specific condition is documented as transient, using a bounded delay and cancellation support.

References


Looking for a different code? Search another status or error code.