<!--
{
  "availability" : [
    "macOS: 14.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Virtualization",
  "identifier" : "/documentation/Virtualization/VZNetworkBlockDeviceStorageDeviceAttachmentDelegate/attachment(_:didEncounterError:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Virtualization"
    ],
    "preciseIdentifier" : "c:objc(pl)VZNetworkBlockDeviceStorageDeviceAttachmentDelegate(im)attachment:didEncounterError:"
  },
  "title" : "attachment(_:didEncounterError:)"
}
-->

# attachment(_:didEncounterError:)

The method the attachment object calls when the NBD client encounters a nonrecoverable error.

```
optional func attachment(_ attachment: VZNetworkBlockDeviceStorageDeviceAttachment, didEncounterError error: any Error)
```

## Parameters

`attachment`

The attachment object calling the delegate method.

`error`

An <doc://com.apple.documentation/documentation/Foundation/NSError> that describes the nonrecoverable error.

## Discussion

After the attachment object calls this method, the NBD client is in a nonfunctional state.

---

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)