<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FoundationModels",
  "identifier" : "/documentation/FoundationModels/LanguageModelError/contextSizeExceeded(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Case",
  "symbol" : {
    "kind" : "Case",
    "modules" : [
      "Foundation Models"
    ],
    "preciseIdentifier" : "s:16FoundationModels18LanguageModelErrorO19contextSizeExceededyA2C07ContextgH0VcACmF"
  },
  "title" : "LanguageModelError.contextSizeExceeded(_:)"
}
-->

# LanguageModelError.contextSizeExceeded(_:)

The session’s transcript exceeded the model’s context size.

```
case contextSizeExceeded(LanguageModelError.ContextSizeExceeded)
```

## Discussion

You can recover from this error by removing entries from the transcript and trying again.

For more information on managing the context window size, see [Managing the context window](/documentation/FoundationModels/managing-the-context-window).

---

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)