<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FoundationModels",
  "identifier" : "/documentation/FoundationModels/GenerationSchema/SchemaError",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Foundation Models",
      "FoundationModels"
    ],
    "preciseIdentifier" : "s:16FoundationModels16GenerationSchemaV0D5ErrorO"
  },
  "title" : "GenerationSchema.SchemaError"
}
-->

# GenerationSchema.SchemaError

An error that occurs when there is a problem creating a generation schema.

```
@nonexhaustive enum SchemaError
```

## Topics

### Getting schema errors

[`case duplicateProperty(schema: String, property: String, context: GenerationSchema.SchemaError.Context)`](/documentation/FoundationModels/GenerationSchema/SchemaError/duplicateProperty(schema:property:context:))

An error that represents an attempt to construct a dynamic schema
with properties that have conflicting names.

[`case duplicateType(schema: String?, type: String, context: GenerationSchema.SchemaError.Context)`](/documentation/FoundationModels/GenerationSchema/SchemaError/duplicateType(schema:type:context:))

An error that represents an attempt to construct a schema from dynamic schemas
in which two or more of the subschemas have the same type name.

[`case emptyTypeChoices(schema: String, context: GenerationSchema.SchemaError.Context)`](/documentation/FoundationModels/GenerationSchema/SchemaError/emptyTypeChoices(schema:context:))

An error that represents an attempt to construct an anyOf schema with an
empty array of type choices.

[`case undefinedReferences(schema: String?, references: [String], context: GenerationSchema.SchemaError.Context)`](/documentation/FoundationModels/GenerationSchema/SchemaError/undefinedReferences(schema:references:context:))

An error that represents an attempt to construct a schema from dynamic schemas
in which one of those schemas references an undefined schema.

[`struct Context`](/documentation/FoundationModels/GenerationSchema/SchemaError/Context)

The context in which the error occurred.

### Getting the error description

[`var errorDescription: String?`](/documentation/FoundationModels/GenerationSchema/SchemaError/errorDescription)

A string representation of the error description.

### Getting the recovery suggestion

[`var recoverySuggestion: String?`](/documentation/FoundationModels/GenerationSchema/SchemaError/recoverySuggestion)

A suggestion that indicates how to handle the error.

### Default Implementations

[LocalizedError Implementations](/documentation/FoundationModels/GenerationSchema/SchemaError/LocalizedError-Implementations)

## Relationships

### Conforms To

[`LocalizedError`](/documentation/Foundation/LocalizedError)

[`Sendable`](/documentation/Swift/Sendable)

[`Error`](/documentation/Swift/Error)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

---

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)