<!--
{
  "availability" : [
    "iOS: 3.0.0 - 7.0.0",
    "iPadOS: 3.0.0 - 7.0.0",
    "macOS: 10.8.0 - 10.10.0",
    "visionOS: 1.0.0 - 1.0.0",
    "watchOS: 2.0.0 - 2.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "GameKit",
  "identifier" : "/documentation/GameKit/GKSessionDelegate/session(_:didFailWithError:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "GameKit"
    ],
    "preciseIdentifier" : "c:objc(pl)GKSessionDelegate(im)session:didFailWithError:"
  },
  "title" : "session(_:didFailWithError:)"
}
-->

# session(_:didFailWithError:)

Sent to the delegate when a serious error has occurred in the session.

```
optional func session(_ session: GKSession, didFailWithError error: any Error)
```

## Parameters

`session`

The session that failed.

`error`

The error that occurred.

## Discussion

This method is called when a serious internal error occurred in the session. Your application should disconnect the session from other peers and release the session.

---

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)