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

# LanguageModelSession.GenerationError.guardrailViolation(_:)

An error that indicates the system’s safety guardrails are triggered by content in a
prompt or the response generated by the model.

```
case guardrailViolation(LanguageModelSession.GenerationError.Context)
```

---

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)