<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppIntents",
  "identifier" : "/documentation/AppIntents/AppIntentError",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "App Intents"
    ],
    "preciseIdentifier" : "s:10AppIntents0A11IntentErrorV"
  },
  "title" : "AppIntentError"
}
-->

# AppIntentError

An error that indicates a problem occurred while performing an app intent.

```
struct AppIntentError
```

## Overview

When your app intent encounters an error during execution, throw an `AppIntentError`
to communicate structured failure information to the system. Apple Intelligence, Siri,
and Shortcuts use this information to determine the appropriate response — such as
prompting a person, retrying the operation, or reporting the failure.

You can create an `AppIntentError` in several ways:

- Predefined errors: Use values from [`AppIntentError.PermissionRequired`](/documentation/AppIntents/AppIntentError/PermissionRequired),
  [`AppIntentError.UserActionRequired`](/documentation/AppIntents/AppIntentError/UserActionRequired), or [`AppIntentError.Unrecoverable`](/documentation/AppIntents/AppIntentError/Unrecoverable) for
  common failure scenarios that the system already knows how to handle.
- Wrapping a custom error: If your error type conforms to
  <doc://com.apple.documentation/documentation/Foundation/CustomLocalizedStringResourceConvertible>,
  pass it to `init(wrapping:)` to provide a localized description.
- Description string: Create an error with a localized description directly from a
  <doc://com.apple.documentation/documentation/Foundation/LocalizedStringResource>
  and pass it to [`init(description:)`](/documentation/AppIntents/AppIntentError/init(description:)).

The recommended approach for most apps is to define an error enumeration that conforms to
`CustomLocalizedStringResourceConvertible` and throw it from your intent's `AppIntent/perform()``
method. The framework automatically wraps conforming errors into an `AppIntentError` with
the localized description you provide.

## Topics

### Getting the error codes

[`static var restartPerform: AppIntentError`](/documentation/AppIntents/AppIntentError/restartPerform)

### Initializers

[`init(description: LocalizedStringResource)`](/documentation/AppIntents/AppIntentError/init(description:))

Creates an error with a localized description.

[`init(predefinedError: AppIntentError, description: LocalizedStringResource)`](/documentation/AppIntents/AppIntentError/init(predefinedError:description:))

Creates an error from a predefined error with a custom localized description.

[`init(wrapping: some CustomAppIntentErrorConvertible)`](/documentation/AppIntents/AppIntentError/init(wrapping:)-2lmed)

Creates an error from a custom app intent convertible value.

[`init(wrapping: some CustomLocalizedStringResourceConvertible & Error)`](/documentation/AppIntents/AppIntentError/init(wrapping:)-4967l)

Creates an error by wrapping an existing localized error.

### Enumerations

[`enum PermissionRequired`](/documentation/AppIntents/AppIntentError/PermissionRequired)

Errors that indicate the app doesn’t have the required permission
to perform an action.

[`enum Unrecoverable`](/documentation/AppIntents/AppIntentError/Unrecoverable)

Unknown or unrecoverable errors that might have occurred due to either
a system or user error.

[`enum UserActionRequired`](/documentation/AppIntents/AppIntentError/UserActionRequired)

Errors that represent a state where a person needs to respond
to successfully complete the action.

### Default Implementations

[CustomLocalizedStringResourceConvertible Implementations](/documentation/AppIntents/AppIntentError/CustomLocalizedStringResourceConvertible-Implementations)

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

---

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)