---
title: HKError
framework: healthkit
role: symbol
role_heading: Structure
path: healthkit/hkerror
---

# HKError

An error returned from a HealthKit method.

## Declaration

```swift
struct HKError
```

## Topics

### Accessing errors

- [HKError.Code](healthkit/hkerror/code.md)
- [noError](healthkit/hkerror/noerror.md)
- [errorHealthDataUnavailable](healthkit/hkerror/errorhealthdataunavailable.md)
- [errorHealthDataRestricted](healthkit/hkerror/errorhealthdatarestricted.md)
- [errorInvalidArgument](healthkit/hkerror/errorinvalidargument.md)
- [errorAuthorizationDenied](healthkit/hkerror/errorauthorizationdenied.md)
- [errorAuthorizationNotDetermined](healthkit/hkerror/errorauthorizationnotdetermined.md)
- [errorRequiredAuthorizationDenied](healthkit/hkerror/errorrequiredauthorizationdenied.md)
- [errorDatabaseInaccessible](healthkit/hkerror/errordatabaseinaccessible.md)
- [errorUserCanceled](healthkit/hkerror/errorusercanceled.md)
- [errorAnotherWorkoutSessionStarted](healthkit/hkerror/erroranotherworkoutsessionstarted.md)
- [errorUserExitedWorkoutSession](healthkit/hkerror/erroruserexitedworkoutsession.md)
- [errorNoData](healthkit/hkerror/errornodata.md)

### Type Properties

- [errorBackgroundWorkoutSessionNotAllowed](healthkit/hkerror/errorbackgroundworkoutsessionnotallowed.md)
- [errorDataSizeExceeded](healthkit/hkerror/errordatasizeexceeded.md)
- [errorDomain](healthkit/hkerror/errordomain.md)
- [errorNotPermissibleForGuestUserMode](healthkit/hkerror/errornotpermissibleforguestusermode.md)
- [errorWorkoutActivityNotAllowed](healthkit/hkerror/errorworkoutactivitynotallowed.md)
- [unknownError](healthkit/hkerror/unknownerror.md)

## Relationships

### Conforms To

- [CustomNSError](foundation/customnserror.md)
- [Equatable](swift/equatable.md)
- [Error](swift/error.md)
- [Hashable](swift/hashable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Errors

- [HKErrorDomain](healthkit/hkerrordomain.md)
- [HKError.Code](healthkit/hkerror/code.md)
