---
title: "init(codingPath:debugDescription:underlyingError:)"
framework: swift
role: symbol
role_heading: Initializer
path: "swift/encodingerror/context/init(codingpath:debugdescription:underlyingerror:)"
---

# init(codingPath:debugDescription:underlyingError:)

Creates a new context with the given path of coding keys and a description of what went wrong.

## Declaration

```swift
init(codingPath: [any CodingKey], debugDescription: String, underlyingError: (any Error)? = nil)
```

## Parameters

- `codingPath`: The path of coding keys taken to get to the point of the failing encode call.
- `debugDescription`: A description of what went wrong, for debugging purposes.
- `underlyingError`: The underlying error which caused this error, if any.
