<!--
{
  "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/init(contextSize:tokenCount:debugDescription:metadata:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Foundation Models",
      "FoundationModels"
    ],
    "preciseIdentifier" : "s:16FoundationModels18LanguageModelErrorO19ContextSizeExceededV07contextG010tokenCount16debugDescription8metadataAESi_SiSSSDySSs8Sendable_pGtcfc"
  },
  "title" : "init(contextSize:tokenCount:debugDescription:metadata:)"
}
-->

# init(contextSize:tokenCount:debugDescription:metadata:)

Creates information describing a transcript that exceeded the model’s context size.

```
init(contextSize: Int, tokenCount: Int, debugDescription: String, metadata: [String : any Sendable] = [:])
```

## Parameters

`contextSize`

The model’s maximum context size, in tokens.

`tokenCount`

The number of tokens in the transcript that exceeded the context size.

`debugDescription`

A developer-facing description of the failure.

`metadata`

Additional information about the failure, keyed by name.

---

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)