---
title: error
framework: metal
role: symbol
role_heading: Instance Property
path: metal/mtlcommandbuffer/error
---

# error

A description of an error when the GPU encounters an issue as it runs the command buffer.

## Declaration

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

## Mentioned in

Preparing your Metal app to run in the background

## Discussion

Discussion You typically check this property during development to get more information about a runtime issue. The property remains nil unless the GPU can’t successfully run the command buffer. An error’s userInfo dictionary property contains additional information if the command buffer’s errorOptions property includes encoderExecutionStatus. You can retrieve an MTLCommandBufferEncoderInfo instance from the dictionary by accessing it with MTLCommandBufferEncoderInfoErrorKey.

## See Also

### Getting error details

- [errorOptions](metal/mtlcommandbuffer/erroroptions.md)
- [MTLCommandBufferEncoderInfo](metal/mtlcommandbufferencoderinfo.md)
- [MTLCommandBufferEncoderInfoErrorKey](metal/mtlcommandbufferencoderinfoerrorkey.md)
