What does HRESULT 0x80020005 (DISP_E_TYPEMISMATCH) mean?

 
Previous Next
DISP_E_PARAMNOTFOUND DISP_E_UNKNOWNNAME

DISP_E_TYPEMISMATCH

Automation argument type does not match the member contract

DISP_E_TYPEMISMATCH is HRESULT 2147614725 (0x80020005) from winerror.h. The documented description is “Type mismatch.” The value must be interpreted at IDispatch::Invoke coercing VARIANTARG values to the parameter types declared by the target.

At least one supplied VARIANT cannot be converted to the required Automation type. Keep the symbolic name beside the raw hexadecimal value so later analysis does not collapse the result into an unrelated COM family.

Where the result appears

  • This result is returned while Automation binds or executes IDispatch::Invoke coercing VARIANTARG values to the parameter types declared by the target.

Determine the object and lifecycle phase that owned this result; a UI symptom cannot establish whether the origin was the caller, proxy, runtime, server, or metadata producer.

Typical causes and interpretation

Common cause categories are: a string is not parseable as the required number; VT_BYREF is missing; SAFEARRAY element type differs; null and empty are confused. Evaluate these branches independently and require evidence from the owning API before promoting one branch to the root cause.

Key distinction: at least one supplied VARIANT cannot be converted to the required Automation type.

Evidence to preserve

  • Record this result with the object CLSID or ProgID, interface identity, member DISPID, dispatch flags, and type-library version.
  • Capture arg-error index; original VARTYPE; expected VARTYPE; by-reference flags; locale; array element type.

Log identifiers, sizes, type tags, states, and hashes while excluding credentials, tokens, document payloads, and complete user arguments.

Correct handling and recovery

The appropriate recovery is to inspect puArgErr, convert explicitly with the correct locale, preserve by-reference semantics, and update the interop signature to the type library. The owner of retry must define idempotency, refreshed state, maximum attempts, backoff, and cancellation responsibility.

After it, apply the API-specific validity rules to outputs and release only resources whose ownership transferred during this attempt.

Practical scenario

A date string works under one locale but fails under another; the client sends VT_DATE instead of relying on locale-sensitive coercion.

A regression test should force the relevant precondition, assert native outputs, fix only that condition, and confirm the expected neighboring result.

Difference from related HRESULTs

TYPE_E_TYPEMISMATCH describes type-library construction or metadata; it occurs while binding a live Automation call.

Represent this distinction directly in control flow and dashboards instead of grouping it under a single COM-failure label.

References


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