| Previous | Next |
| WCM_E_TYPENOTSPECIFIED | WCM_E_NOTPOSITIONED |
WCM_E_INVALIDDATATYPE
WCM_E_INVALIDDATATYPE is the failure HRESULT 0x80220008 (signed decimal -2145255416, unsigned decimal 2149711880). Its severity bit is 1, facility is 34 (FACILITY_STATE_MANAGEMENT), and the facility-specific code field is 0x0008.
AllStat records the Windows SDK description as “Data type is unexpected, or existing data does not match the type.”
Documented meaning
The value type disagrees with SMI metadata. The operation reached reading existing backing-store data, assigning a VARIANT, or validating serialized settings against WcmDataType. The first branch to test is whether the caller supplies a VARIANT of the wrong VARTYPE; keep that separate from the possibility that backing-store data was written outside SMI using an incompatible registry or file representation.
Operation phase
At this boundary, capture declared WcmDataType and actual VARIANT VARTYPE, then correlate it with raw backing-store value, size, and storage location. Assign ownership only after checking namespace/schema version before and after servicing.
Root-cause branches
- the caller supplies a VARIANT of the wrong VARTYPE
- backing-store data was written outside SMI using an incompatible registry or file representation
- metadata changed type without migrating existing state
- raw serialization/deserialization preserved bytes but not the expected logical type
Diagnostic record
- declared WcmDataType and actual VARIANT VARTYPE
- raw backing-store value, size, and storage location
- namespace/schema version before and after servicing
- whether GetValueRaw and typed GetValue disagree
- the precise operation that first observes the mismatch
Correction workflow
- read the item type before constructing the assignment value
- inspect and back up existing state rather than overwriting it blindly
- migrate old representations through the component-supported upgrade path
- validate serialization round trips using the same schema version
- repair only the affected state after identifying its authoritative owner
Retry policy
Retry after correcting the VARIANT or migrating the stored data. Repeated reads of incompatible persisted state will continue to fail.
Nearby HRESULT distinctions
WCM_E_INVALIDVALUEFORMAT applies when text cannot be parsed; WCM_E_INVALIDVALUE applies when a correctly typed value is not permitted. INVALIDDATATYPE identifies the type boundary itself.
Concrete example
Metadata now declares an unsigned integer, but an older image stores the setting as a string. SMI rejects the existing representation when opening the item.
Operational logging
For operational telemetry, retain namespace/schema version before and after servicing; also record whether GetValueRaw and typed GetValue disagree. Preserve a redacted summary of the precise operation that first observes the mismatch; use a cryptographic hash when that evidence is a file, stream, or generated artifact.
Official Microsoft references.
- Microsoft: SMI error and success constants.
- Microsoft: Settings Management Infrastructure API.
- Microsoft: SMI interfaces.
- Microsoft: WcmDataType.
- Microsoft: ISettingsItem::GetDataType.
Looking for a different code? Search another status or error code.
