---
title: error
framework: coreml
role: symbol
role_heading: Instance Property
path: coreml/mltask/error
---

# error

The underlying error if the task is in a failed state.

## Declaration

```swift
var error: (any Error)? { get }
```

## See Also

### Checking the state of a task

- [state](coreml/mltask/state.md)
- [MLTaskState](coreml/mltaskstate.md)
