<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Swift",
  "identifier" : "/documentation/Swift/DecodingError/typeMismatch(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Case",
  "symbol" : {
    "kind" : "Case",
    "modules" : [
      "Swift"
    ],
    "preciseIdentifier" : "s:s13DecodingErrorO12typeMismatchyABypXp_AB7ContextVtcABmF"
  },
  "title" : "DecodingError.typeMismatch(_:_:)"
}
-->

# DecodingError.typeMismatch(_:_:)

An indication that a value of the given type could not be decoded because
it did not match the type of what was found in the encoded payload.

```
case typeMismatch(any Any.Type, DecodingError.Context)
```

## Discussion

As associated values, this case contains the attempted type and context
for debugging.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)