What does Windows error code 604 (ERROR_INVALID_VARIANT) mean?

 
Previous Next
ERROR_MARSHALL_OVERFLOW ERROR_BAD_COMPRESSION_BUFFER

ERROR_INVALID_VARIANT

What ERROR_INVALID_VARIANT means

The type tag and payload do not form a legal automation value. Consumers cannot safely interpret or clear the value until its representation and ownership rules are understood.

Where it appears

  • COM Automation and OLE interfaces
  • WMI, scripting, and property systems
  • marshalling values across process or language boundaries

Likely causes

  • unsupported or reserved VARTYPE combination
  • pointer payload is null or invalid for its tag
  • array, by-reference, or ownership flags are inconsistent
  • memory corruption or mismatched structure packing

What to collect

  1. vt field in hexadecimal
  2. union member, array descriptor, and by-reference target
  3. producer and consumer architecture
  4. marshalling boundary and component versions

How to respond

Initialize values with VariantInit, assign only fields defined for the selected VARTYPE, and release them with the matching ownership rules. Reject malformed external data before calling VariantClear or dereferencing payload pointers.

Example

A COM server returns a value tagged as a BSTR while the union contains an invalid pointer. The client must treat the result as a contract violation and capture the producer version; attempting to display or clear the malformed value can trigger a second crash.

References


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