<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLCommandBuffer/error",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLCommandBuffer(py)error"
  },
  "title" : "error"
}
-->

# error

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

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

## 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 <doc://com.apple.documentation/documentation/Foundation/NSError/userInfo> dictionary property contains additional information if the command buffer’s [`errorOptions`](/documentation/Metal/MTLCommandBuffer/errorOptions) property includes [`encoderExecutionStatus`](/documentation/Metal/MTLCommandBufferErrorOption/encoderExecutionStatus). You can retrieve an [`MTLCommandBufferEncoderInfo`](/documentation/Metal/MTLCommandBufferEncoderInfo) instance from the dictionary by accessing it with [`MTLCommandBufferEncoderInfoErrorKey`](/documentation/Metal/MTLCommandBufferEncoderInfoErrorKey).

---

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)