| Previous | Next |
| ERROR_CRC | ERROR_SEEK |
ERROR_BAD_LENGTH
The supplied length does not match the operation
ERROR_BAD_LENGTH is returned when a program issues a command whose declared size is invalid for the receiving API, device, or structure. It can expose byte-versus-element mistakes, incorrect packing, truncated requests, or use of a structure version unsupported by the driver.
Validation points
- Compare the input and output sizes with the exact function prototype.
- Use
sizeofon the structure object, not on a pointer. - Check architecture-dependent fields and explicit packing directives.
- Guard additions and multiplications used to calculate variable payload sizes.
Recovery
Rebuild the request with the documented size and initialize any structure-length member. Do not blindly enlarge the buffer: some interfaces require an exact length rather than a minimum. If the error appears only on one Windows version, review the versioned structure contract.
References
Looking for a different code? Search another status or error code.
