<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKNavigationDelegate/webView(_:didFail:withError:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(pl)WKNavigationDelegate(im)webView:didFailNavigation:withError:"
  },
  "title" : "webView(_:didFail:withError:)"
}
-->

# webView(_:didFail:withError:)

Tells the delegate that an error occurred during navigation.

```
optional func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: any Error)
```

## Parameters

`webView`

The web view that reported the error.

`navigation`

The navigation object for the operation. This object corresponds to a [`WKNavigation`](/documentation/WebKit/WKNavigation) object that WebKit returned when the load operation began. You use it to track the progress of that operation.

`error`

The error that occurred.

## Discussion

---

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)